|
|
@@ -11,21 +11,26 @@ const emptyChange = (el, binding, vnode) => {
|
|
|
return
|
|
|
}
|
|
|
// binding.value为对象{open:true,text:'空文案'} 配合v-model 使用
|
|
|
- let isEmpty = false
|
|
|
- if (binding.value.open) {
|
|
|
- if (!vnode.data.model.value) {
|
|
|
- isEmpty = true
|
|
|
+ vnode.child.$nextTick(() => {
|
|
|
+ let isEmpty = false
|
|
|
+ if (binding.value.open) {
|
|
|
+ if (!vnode.data.model.value) {
|
|
|
+ isEmpty = true
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (isEmpty) {
|
|
|
- el.classList.add('hide-child', 'gray-color')
|
|
|
- el.appendChild(document.createTextNode(binding.value.text))
|
|
|
- } else {
|
|
|
- if (el.classList.contains('hide-child')) {
|
|
|
- el.classList.remove('hide-child', 'gray-color')
|
|
|
- el.removeChild(el.lastChild)
|
|
|
+ if (isEmpty) {
|
|
|
+ // console.log('hide-child', el.classList.contains('hide-child'))
|
|
|
+ if (!el.classList.contains('hide-child')) {
|
|
|
+ el.classList.add('hide-child', 'gray-color')
|
|
|
+ el.appendChild(document.createTextNode(binding.value.text))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (el.classList.contains('hide-child')) {
|
|
|
+ el.classList.remove('hide-child', 'gray-color')
|
|
|
+ el.removeChild(el.lastChild)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
const empty = {
|
|
|
bind: emptyChange,
|