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.
53 lines
923 B
53 lines
923 B
<template>
|
|
<rich-text :nodes="nodes" :class="node.classStr" :style="'user-select:' + parseSelect"></rich-text>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
name: 'wxParseTable',
|
|
props: {
|
|
node: {
|
|
type: Object,
|
|
default() {
|
|
return {};
|
|
},
|
|
},
|
|
},
|
|
inject: ['parseSelect'],
|
|
data() {
|
|
return {
|
|
nodes:[]
|
|
};
|
|
},
|
|
mounted() {
|
|
this.nodes=this.loadNode([this.node]);
|
|
},
|
|
methods: {
|
|
loadNode(node) {
|
|
let obj = [];
|
|
for (let children of node) {
|
|
if (children.node=='element') {
|
|
let t = {
|
|
name:children.tag,
|
|
attrs: {
|
|
class: children.classStr,
|
|
// style: children.styleStr,
|
|
},
|
|
children: children.nodes?this.loadNode(children.nodes):[]
|
|
}
|
|
|
|
obj.push(t)
|
|
} else if(children.node=='text'){
|
|
obj.push({
|
|
type: 'text',
|
|
text: children.text
|
|
})
|
|
}
|
|
}
|
|
return obj
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style>
|
|
@import url("../parse.css");
|
|
</style>
|