智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/02/025a1eac2a805ed4aa892081d64...

40 lines
784 B

<template>
<uni-rich-text v-on="$listeners">
<div />
</uni-rich-text>
</template>
<script>
import parseHtml from './html-parser'
import parseNodes from './nodes-parser'
export default {
name: 'RichText',
props: {
nodes: {
type: [Array, String],
default: function () {
return []
}
}
},
watch: {
nodes (value) {
this._renderNodes(value)
}
},
mounted () {
this._renderNodes(this.nodes)
},
methods: {
_renderNodes (nodes) {
if (typeof nodes === 'string') {
nodes = parseHtml(nodes)
}
const nodeList = parseNodes(nodes, document.createDocumentFragment())
this.$el.firstChild.innerHTML = ''
this.$el.firstChild.appendChild(nodeList)
}
}
}
</script>
<style></style>