Skip to content

Commit

Permalink
fix(textarea): 修复类型导出缺失
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohe0601 committed Mar 4, 2024
1 parent a6ba625 commit 1fa9f29
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/nutui/components/textarea/index.ts
@@ -1 +1,2 @@
export * from './textarea'
export * from './type'
4 changes: 2 additions & 2 deletions packages/nutui/components/textarea/textarea.ts
Expand Up @@ -2,7 +2,7 @@ import type { ExtractPropTypes, PropType } from 'vue'
import { commonProps, isString, makeNumberProp, makeStringProp, truthProp } from '../_utils'
import { BLUR_EVENT, CHANGE_EVENT, CONFIRM_EVENT, FOCUS_EVENT, UPDATE_MODEL_EVENT } from '../_constants'
import type { InputAlignType } from '../input'
import type { TextareaAdjustKeyboardTo, TextareaConfirmType } from './type'
import type { TextareaAdjustKeyboardTo, TextareaAutosizeObject, TextareaConfirmType } from './type'

export const textareaProps = {
...commonProps,
Expand Down Expand Up @@ -50,7 +50,7 @@ export const textareaProps = {
* @description 是否自适应内容高度,也可传入对象
*/
autosize: {
type: [Boolean, Object],
type: [Boolean, Object as PropType<TextareaAutosizeObject>],
default: false,
},
/**
Expand Down
6 changes: 1 addition & 5 deletions packages/nutui/components/textarea/textarea.vue
@@ -1,4 +1,3 @@
<!-- eslint-disable padded-blocks -->
<script setup lang="ts">
import type { CSSProperties } from 'vue'
import type * as CSS from 'csstype'
Expand All @@ -8,12 +7,9 @@ import { getMainClass, isH5, isMpAlipay, pxCheck } from '../_utils'
import { BLUR_EVENT, CHANGE_EVENT, CONFIRM_EVENT, FOCUS_EVENT, PREFIX, UPDATE_MODEL_EVENT } from '../_constants'
import { useTranslate } from '../../locale'
import { useFormDisabled } from '../form/form'
import type { InputTarget } from '../input/type'
import { textareaEmits, textareaProps } from './textarea'
export interface InputTarget extends HTMLInputElement {
composing?: boolean
}
const props = defineProps(textareaProps)
const emit = defineEmits(textareaEmits)
const disabled = useFormDisabled(toRef(props, 'disabled'))
Expand Down
17 changes: 15 additions & 2 deletions packages/nutui/components/textarea/type.ts
@@ -1,3 +1,16 @@
export type TextareaConfirmType = 'send' | 'search' | 'next' | 'go' | 'done' | 'return'
export interface TextareaAutosizeObject {
/**
* 最大高度
*/
maxHeight?: number | string
/**
* 最小高度
*/
minHeight?: number | string
}

export type TextareaAdjustKeyboardTo = 'cursor' | 'bottom'
export const textareaConfirmType = ['send', 'search', 'next', 'go', 'done', 'return'] as const
export type TextareaConfirmType = (typeof textareaConfirmType)[number]

export const textareaAdjustKeyboardTo = ['cursor', 'bottom']
export type TextareaAdjustKeyboardTo = (typeof textareaAdjustKeyboardTo)[number]

0 comments on commit 1fa9f29

Please sign in to comment.