提交 035a7820 编写于 作者: Q qiang

fix: 修复 app-v3 cover-view 组件内容无法更新的问题

上级 6eb1346a
<template>
<uni-cover-view
v-on="$listeners">
<div
ref="container"
class="uni-cover-view"
v-text="coverContent"/>
</uni-cover-view>
</template>
<script>
import native from '../../mixins/native'
import cover from '../../mixins/cover'
......@@ -21,20 +12,23 @@ export default {
coverContent: ''
}
},
watch: {},
mounted () {
this._updateContent()
this.$watch('$slot', this._updateContent)
},
methods: {
_updateContent (val) {
const $slots = this.$slots.default || []
$slots.forEach(node => {
if (!node.tag) {
this.coverContent += node.text || ''
}
})
}
render (createElement) {
let coverContent = ''
const $slots = this.$slots.default || []
$slots.forEach(node => {
if (!node.tag) {
coverContent += node.text || ''
}
})
this.coverContent = coverContent
return createElement('uni-cover-view', {
on: {
on: this.$listeners
}
}, [createElement('div', {
ref: 'container',
staticClass: 'uni-cover-view'
}, [coverContent])])
}
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册