File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1212 :id =" elId"
1313 ref =" el"
1414 :type =" htmlType"
15+ :inputmode =" inputmode"
1516 :name =" name"
1617 :placeholder =" !focused ? '' : placeholder"
1718 @focus =" handleInputFocus"
2425 </div >
2526</template >
2627<script setup lang="ts">
27- import { ref , watch } from ' vue' ;
28+ import { ref , computed } from ' vue' ;
2829import { random , isBlank } from ' ph-utils' ;
2930
3031const el = ref <HTMLInputElement >();
3132
3233const modelValue = defineModel <string | number >();
3334
3435const focused = ref (false );
35- const hasValue = ref (false );
3636
3737const props = withDefaults (
3838 defineProps <{
@@ -41,8 +41,9 @@ const props = withDefaults(
4141 outline? : boolean ;
4242 label? : string ;
4343 placeholder? : string ;
44- htmlType? : ' text' | ' number' | ' password' ;
44+ htmlType? : ' text' | ' number' | ' password' | ' tel ' ;
4545 name? : string ;
46+ inputmode? : ' text' | ' numeric' | ' decimal' | ' tel' ;
4647 }>(),
4748 {
4849 outline: false ,
@@ -68,8 +69,8 @@ function handleInputBlur() {
6869 focused .value = false ;
6970}
7071
71- watch ( modelValue , ( v ) => {
72- hasValue .value = isBlank ( v ) ? false : true ;
72+ const hasValue = computed (( ) => {
73+ return isBlank ( modelValue .value as string ) ? false : true ;
7374});
7475
7576defineExpose ({
You can’t perform that action at this time.
0 commit comments