Browse Source

fix: 抽离 input ConfirmTextType (#1337)

ailululu 3 years ago
parent
commit
1c31daf453
2 changed files with 4 additions and 39 deletions
  1. 2 39
      src/packages/__VUE/input/index.taro.vue
  2. 2 0
      src/packages/__VUE/input/type.ts

+ 2 - 39
src/packages/__VUE/input/index.taro.vue

@@ -94,44 +94,6 @@ import { createComponent } from '@/packages/utils/create';
 import { formatNumber } from './util';
 
 const { componentName, create, translate } = createComponent('input');
-interface Events {
-  eventName: 'focus' | 'blur' | 'clear' | 'change' | 'update:modelValue';
-  params: (string | number | Event)[];
-}
-export type InputAlignType = 'left' | 'center' | 'right'; // text-align
-export type InputFormatTrigger = 'onChange' | 'onBlur'; // onChange: 在输入时执行格式化 ; onBlur: 在失焦时执行格式化
-export type InputType =
-  | 'tel'
-  | 'url'
-  | 'date'
-  | 'file'
-  | 'text'
-  | 'time'
-  | 'week'
-  | 'color'
-  | 'digit'
-  | 'email'
-  | 'image'
-  | 'month'
-  | 'radio'
-  | 'range'
-  | 'reset'
-  | 'button'
-  | 'hidden'
-  | 'number'
-  | 'search'
-  | 'submit'
-  | 'checkbox'
-  | 'password'
-  | 'textarea'
-  | 'datetime-local';
-export type confirmTextType = 'send' | 'search' | 'next' | 'go' | 'done'
-
-export type InputRule = {
-  pattern?: RegExp;
-  message?: string;
-  required?: boolean;
-};
 
 export default create({
   props: {
@@ -264,8 +226,9 @@ export default create({
       default: false
     },
     confirmType: {
-      type: String as PropType<confirmTextType>,
+      type: String as PropType<import('./type').ConfirmTextType>,
       default: 'done'
+    },
     adjustPosition: {
       type: Boolean,
       default: true

+ 2 - 0
src/packages/__VUE/input/type.ts

@@ -31,3 +31,5 @@ export type InputRule = {
   message?: string;
   required?: boolean;
 };
+
+export type ConfirmTextType = 'send' | 'search' | 'next' | 'go' | 'done';