Skip to content

Commit 8f56ff0

Browse files
subordoneiinu
andauthored
refactor(textarea): move to script setup (#2997)
* refactor(textarea): move to script setup * fix: type * chore: update --------- Co-authored-by: Eiinu <[email protected]>
1 parent 7a642c4 commit 8f56ff0

File tree

11 files changed

+479
-475
lines changed

11 files changed

+479
-475
lines changed

src/config.json

+1
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@
431431
"version": "3.0.0",
432432
"name": "Textarea",
433433
"cName": "文本域",
434+
"setup": true,
434435
"desc": "文本输入",
435436
"author": "gx"
436437
},

src/packages/__VUE/textarea/__tests__/textarea.spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,17 @@ test('should emit blur event when textarea is blur', () => {
117117
wrapper.find('textarea').trigger('blur')
118118
expect(wrapper.emitted('blur')).toBeTruthy()
119119
})
120+
121+
test('should set height when autosize is object', async () => {
122+
const wrapper = mount(Textarea, {
123+
props: {
124+
autosize: {
125+
minHeight: 200,
126+
maxHeight: 300
127+
}
128+
}
129+
})
130+
await nextTick()
131+
const txtWrapper = wrapper.find('.nut-textarea__textarea').element as HTMLTextAreaElement
132+
expect(txtWrapper.style.height).toBe('200px')
133+
})

src/packages/__VUE/textarea/doc.en-US.md

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ app.use(Textarea)
5959
| focus | Triggered when focusing | `event` |
6060
| blur | Triggered when out of focus | `value,event` |
6161

62+
### Types version
63+
64+
The component exports the following type definitions:
65+
66+
```js
67+
import type { TextareaProps, TextareaInstance } from '@nutui/nutui';
68+
```
69+
6270
## Theming
6371

6472
### CSS Variables

src/packages/__VUE/textarea/doc.md

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ app.use(Textarea)
5959
| focus | 聚焦时触发 | `event` |
6060
| blur | 失焦时触发 | `value,event` |
6161

62+
### 类型定义 version
63+
64+
组件导出以下类型定义:
65+
66+
```js
67+
import type { TextareaProps, TextareaInstance } from '@nutui/nutui';
68+
```
69+
6270
## 主题定制
6371

6472
### 样式变量

src/packages/__VUE/textarea/doc.taro.md

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ app.use(Textarea)
6161
| focus | 聚焦时触发 | `event` |
6262
| blur | 失焦时触发 | `value,event` |
6363

64+
### 类型定义 version
65+
66+
组件导出以下类型定义:
67+
68+
```js
69+
import type { TextareaProps, TextareaInstance } from '@nutui/nutui-taro';
70+
```
71+
6472
## 主题定制
6573

6674
### 样式变量
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Textarea from './textarea.taro.vue'
2+
import type { ComponentPublicInstance } from 'vue'
3+
import { withInstall } from '@/packages/utils'
4+
5+
withInstall(Textarea)
6+
7+
export type { TextareaProps } from './textarea.taro.vue'
8+
9+
export type TextareaInstance = ComponentPublicInstance & InstanceType<typeof Textarea>
10+
11+
export { Textarea, Textarea as default }

src/packages/__VUE/textarea/index.taro.vue

-273
This file was deleted.

src/packages/__VUE/textarea/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Textarea from './textarea.vue'
2+
import type { ComponentPublicInstance } from 'vue'
3+
import { withInstall } from '@/packages/utils'
4+
5+
withInstall(Textarea)
6+
7+
export type { TextareaProps } from './textarea.vue'
8+
9+
export type TextareaInstance = ComponentPublicInstance & InstanceType<typeof Textarea>
10+
11+
export { Textarea, Textarea as default }

0 commit comments

Comments
 (0)