|
|
@@ -120,18 +120,24 @@ export default create({
|
|
|
const comLen = computed(() => range(Number(props.length)));
|
|
|
const show = ref(props.visible);
|
|
|
const isWx = ref(false); // 判断是否为微信端
|
|
|
+ const dom = ref();
|
|
|
// 方法
|
|
|
function sureClick() {
|
|
|
emit('ok', realInput.value);
|
|
|
}
|
|
|
function focus() {
|
|
|
- let a: any = '';
|
|
|
+ let dom: any = '';
|
|
|
if (isWx.value) {
|
|
|
- a = document.getElementsByClassName('nut-input-real-taro')[0] as any;
|
|
|
- a.focus();
|
|
|
+ setTimeout(() => {
|
|
|
+ dom = document.getElementsByClassName(
|
|
|
+ 'nut-input-real-taro'
|
|
|
+ )[0] as any;
|
|
|
+ if (!dom) return;
|
|
|
+ dom.focus();
|
|
|
+ }, 100);
|
|
|
} else {
|
|
|
- a = document.getElementsByClassName('nut-input-real')[0] as any;
|
|
|
- let h = a.children[0];
|
|
|
+ dom = document.getElementsByClassName('nut-input-real')[0] as any;
|
|
|
+ let h = dom.children[0];
|
|
|
h.focus();
|
|
|
}
|
|
|
}
|
|
|
@@ -141,6 +147,12 @@ export default create({
|
|
|
show.value = value;
|
|
|
}
|
|
|
);
|
|
|
+ watch(
|
|
|
+ () => props.modelValue,
|
|
|
+ (value) => {
|
|
|
+ realInput.value = value;
|
|
|
+ }
|
|
|
+ );
|
|
|
function changeValue(e: Event) {
|
|
|
const input = e.target as HTMLInputElement;
|
|
|
let val = input.value;
|