优化提示查找逻辑

pull/389/head
lyswhut 2020-09-29 14:41:41 +08:00
parent 1b561bbf4c
commit 3a630edaa5
2 changed files with 7 additions and 24 deletions

View File

@ -1,6 +1,6 @@
<template lang="pug">
input(:class="$style.input" :type="type" :placeholder="placeholder" v-model.trim="text" :disabled="disabled"
@focus="$emit('focus', $event)" @blur="$emit('blur', $event)" @input="$emit('input', text)" @change="$emit('change', text)"
input(:class="$style.input" :type="type" :placeholder="placeholder" :value="value" :disabled="disabled"
@focus="$emit('focus', $event)" @blur="$emit('blur', $event)" @input="$emit('input', $event.trim())" @change="$emit('change', text)"
@keyup.enter="$emit('submit', text)")
</template>
@ -24,21 +24,6 @@ export default {
default: 'text',
},
},
data() {
return {
text: '',
}
},
watch: {
value(n) {
this.text = n
},
},
methods: {
handleInput() {
},
},
}
</script>

View File

@ -4,13 +4,11 @@ import { debounce } from '../../utils'
let instance
let prevTips
const getTips = el => el == null
? null
: el.getAttribute('tips')
? el.getAttribute('tips')
: el.parentNode === document.body
? null
: getTips(el.parentNode)
const getTips = el => el.getAttribute('tips')
? el.getAttribute('tips')
: el.parentNode === document.documentElement
? null
: getTips(el.parentNode)
const showTips = debounce(event => {
let msg = getTips(event.target)