Skip to content

Commit

Permalink
refactor(textarea): move to script setup (#2997)
Browse files Browse the repository at this point in the history
* refactor(textarea): move to script setup

* fix: type

* chore: update

---------

Co-authored-by: Eiinu <[email protected]>
  • Loading branch information
subordon and eiinu authored Apr 1, 2024
1 parent 7a642c4 commit 8f56ff0
Show file tree
Hide file tree
Showing 11 changed files with 479 additions and 475 deletions.
1 change: 1 addition & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@
"version": "3.0.0",
"name": "Textarea",
"cName": "文本域",
"setup": true,
"desc": "文本输入",
"author": "gx"
},
Expand Down
14 changes: 14 additions & 0 deletions src/packages/__VUE/textarea/__tests__/textarea.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,17 @@ test('should emit blur event when textarea is blur', () => {
wrapper.find('textarea').trigger('blur')
expect(wrapper.emitted('blur')).toBeTruthy()
})

test('should set height when autosize is object', async () => {
const wrapper = mount(Textarea, {
props: {
autosize: {
minHeight: 200,
maxHeight: 300
}
}
})
await nextTick()
const txtWrapper = wrapper.find('.nut-textarea__textarea').element as HTMLTextAreaElement
expect(txtWrapper.style.height).toBe('200px')
})
8 changes: 8 additions & 0 deletions src/packages/__VUE/textarea/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ app.use(Textarea)
| focus | Triggered when focusing | `event` |
| blur | Triggered when out of focus | `value,event` |

### Types version

The component exports the following type definitions:

```js
import type { TextareaProps, TextareaInstance } from '@nutui/nutui';
```

## Theming

### CSS Variables
Expand Down
8 changes: 8 additions & 0 deletions src/packages/__VUE/textarea/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ app.use(Textarea)
| focus | 聚焦时触发 | `event` |
| blur | 失焦时触发 | `value,event` |

### 类型定义 version

组件导出以下类型定义:

```js
import type { TextareaProps, TextareaInstance } from '@nutui/nutui';
```

## 主题定制

### 样式变量
Expand Down
8 changes: 8 additions & 0 deletions src/packages/__VUE/textarea/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ app.use(Textarea)
| focus | 聚焦时触发 | `event` |
| blur | 失焦时触发 | `value,event` |

### 类型定义 version

组件导出以下类型定义:

```js
import type { TextareaProps, TextareaInstance } from '@nutui/nutui-taro';
```

## 主题定制

### 样式变量
Expand Down
11 changes: 11 additions & 0 deletions src/packages/__VUE/textarea/index.taro.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Textarea from './textarea.taro.vue'
import type { ComponentPublicInstance } from 'vue'
import { withInstall } from '@/packages/utils'

withInstall(Textarea)

export type { TextareaProps } from './textarea.taro.vue'

export type TextareaInstance = ComponentPublicInstance & InstanceType<typeof Textarea>

export { Textarea, Textarea as default }
273 changes: 0 additions & 273 deletions src/packages/__VUE/textarea/index.taro.vue

This file was deleted.

11 changes: 11 additions & 0 deletions src/packages/__VUE/textarea/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Textarea from './textarea.vue'
import type { ComponentPublicInstance } from 'vue'
import { withInstall } from '@/packages/utils'

withInstall(Textarea)

export type { TextareaProps } from './textarea.vue'

export type TextareaInstance = ComponentPublicInstance & InstanceType<typeof Textarea>

export { Textarea, Textarea as default }
Loading

0 comments on commit 8f56ff0

Please sign in to comment.