Skip to content

Commit

Permalink
feat(input): input增加pattern, inputmode的透传
Browse files Browse the repository at this point in the history
  • Loading branch information
LoopZhou committed Nov 22, 2023
1 parent 10e38b1 commit f85e3cb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/input/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
:placeholder="placeholder"
:readonly="readonly"
:maxlength="maxlength || -1"
:pattern="pattern"
:inputmode="inputmode"
@focus="handleFocus"
@blur="handleBlur"
@input="handleInput"
Expand Down Expand Up @@ -50,8 +52,8 @@
</template>

<script lang="ts">
import { PropType, ref, computed, defineComponent, getCurrentInstance, toRefs, nextTick, watch } from 'vue';
import { CloseCircleFilledIcon } from 'tdesign-icons-vue-next';
import { ref, computed, defineComponent, getCurrentInstance, toRefs, nextTick, watch } from 'vue';
import { useFocus } from '@vueuse/core';
import config from '../config';
import InputProps from './props';
Expand All @@ -74,6 +76,16 @@ export default defineComponent({
type: String,
default: 'top',
},
pattern: {
type: String,
},
inputmode: {
type: String as PropType<'search' | 'text' | 'none' | 'url' | 'tel' | 'email' | 'numeric' | 'decimal'>,
validator(val: string): boolean {
if (!val) return true;
return ['search', 'text', 'none', 'url', 'tel', 'email', 'numeric', 'decimal'].includes(val);
},
},
},
emits: ['update:value', 'update:modelValue', 'click-icon', 'focus', 'blur', 'change', 'clear'],
setup(props, context) {
Expand Down

0 comments on commit f85e3cb

Please sign in to comment.