1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
| <template>
| <div class='tablebox'>
| <rich-text :nodes="nodes" :class="node.classStr" :style="'user-select:' + parseSelect"></rich-text>
| </div>
| </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) {
| console.log(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>
|
|