@10yun/cv-mobile-ui 0.5.7 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui-cv/cv-block/cv-block.vue +1 -4
- package/ui-cv/cv-cell/cv-cell.vue +3 -2
- package/ui-cv/cv-editor-parse/components/wxParseAudio.vue +14 -5
- package/ui-cv/cv-editor-parse/components/wxParseImg.vue +26 -36
- package/ui-cv/cv-editor-parse/components/wxParseTable.vue +7 -7
- package/ui-cv/cv-editor-parse/components/wxParseTemplate0.vue +105 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate1.vue +96 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate10.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate11.vue +84 -82
- package/ui-cv/cv-editor-parse/components/wxParseTemplate2.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate3.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate4.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate5.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate6.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate7.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate8.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate9.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseVideo.vue +15 -15
- package/ui-cv/cv-editor-parse/cv-editor-parse.vue +1 -3
- package/ui-cv/cv-editor-parse/libs/html2json.js +15 -18
- package/ui-cv/cv-editor-parse/libs/htmlparser.js +12 -5
- package/ui-cv/cv-editor-parse/libs/wxDiscode.js +1 -1
- package/ui-cv/cv-editor-parse/readme.md +6 -0
- package/ui-cv/cv-editor-parse/u-parse.css +52 -95
- package/ui-cv/cv-icons/cv-icons.vue +2 -11
- package/ui-cv/cv-markdown-show/cv-markdown-show.vue +109 -0
- package/ui-cv/cv-markdown-show/lib/highlight/atom-one-dark.css +1 -0
- package/ui-cv/cv-markdown-show/lib/highlight/atom-one-light.css +1 -0
- package/ui-cv/cv-markdown-show/lib/highlight/github-dark.min.css +10 -0
- package/ui-cv/cv-markdown-show/lib/highlight/uni-highlight.min.js +5254 -0
- package/ui-cv/cv-markdown-show/lib/html-parser.js +352 -0
- package/ui-cv/cv-markdown-show/lib/markdown-it.min.js +2 -0
- package/ui-cv/cv-markdown-show/markdown.css +340 -0
- package/ui-cv/cv-markdown-show/package.json +18 -0
- package/ui-cv/cv-markdown-show/readme.md +45 -0
- package/ui-cv/cv-nav-col/cv-nav-col.vue +2 -1
- package/ui-cv/cv-nav-row/cv-nav-row.vue +3 -2
- package/ui-cv/cv-treaty/cv-treaty.vue +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="cv-block" v-bind:style="cvBoxStyle"
|
|
2
|
+
<view class="cv-block" v-bind:style="cvBoxStyle">
|
|
3
3
|
<slot name="default" />
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
@@ -68,9 +68,6 @@ export default {
|
|
|
68
68
|
cvBoxStyle += 'margin-bottom:' + marginBottom + 'px;';
|
|
69
69
|
}
|
|
70
70
|
this.cvBoxStyle = cvBoxStyle;
|
|
71
|
-
},
|
|
72
|
-
onClick() {
|
|
73
|
-
this.$emit('click');
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
};
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</view>
|
|
22
22
|
</view>
|
|
23
23
|
</view>
|
|
24
|
-
<view class="cv-cell-main-center" :class="url == '' && !$
|
|
24
|
+
<view class="cv-cell-main-center" :class="url == '' && !$attrs.click ? 'cv-cell-main-center-nourl' : ''">
|
|
25
25
|
<view class="cv-cell-main-center-intact" v-if="!subexplain">
|
|
26
26
|
{{ explain }}
|
|
27
27
|
</view>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</view>
|
|
35
35
|
</view>
|
|
36
36
|
</view>
|
|
37
|
-
<view class="cv-cell-main-more" v-if="url || $
|
|
37
|
+
<view class="cv-cell-main-more" v-if="url || $attrs.click">
|
|
38
38
|
<view class="cv-cell-main-more-top"></view>
|
|
39
39
|
<view class="cv-cell-main-more-bottom"></view>
|
|
40
40
|
</view>
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
<script>
|
|
50
50
|
export default {
|
|
51
|
+
emits: ['click'],
|
|
51
52
|
name: 'cvCell',
|
|
52
53
|
options: {
|
|
53
54
|
addGlobalClass: true
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- '<audio/>' 组件不再维护,建议使用能力更强的 'uni.createInnerAudioContext' 接口 有时间再改-->
|
|
3
3
|
<!--增加audio标签支持-->
|
|
4
|
-
<audio
|
|
5
|
-
:
|
|
4
|
+
<audio
|
|
5
|
+
:id="node.attr.id"
|
|
6
|
+
:class="node.classStr"
|
|
7
|
+
:style="node.styleStr"
|
|
8
|
+
:src="node.attr.src"
|
|
9
|
+
:loop="node.attr.loop"
|
|
10
|
+
:poster="node.attr.poster"
|
|
11
|
+
:name="node.attr.name"
|
|
12
|
+
:author="node.attr.author"
|
|
13
|
+
controls
|
|
14
|
+
></audio>
|
|
6
15
|
</template>
|
|
7
16
|
|
|
8
17
|
<script>
|
|
@@ -13,8 +22,8 @@ export default {
|
|
|
13
22
|
type: Object,
|
|
14
23
|
default() {
|
|
15
24
|
return {};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
19
28
|
};
|
|
20
29
|
</script>
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<image
|
|
3
|
-
:
|
|
2
|
+
<image
|
|
3
|
+
:mode="node.attr.mode"
|
|
4
|
+
:lazy-load="node.attr.lazyLoad"
|
|
5
|
+
:class="node.classStr"
|
|
6
|
+
:style="newStyleStr || node.styleStr"
|
|
7
|
+
:data-src="node.attr.src"
|
|
8
|
+
:src="node.attr.src"
|
|
9
|
+
@tap="wxParseImgTap"
|
|
10
|
+
@load="wxParseImgLoad"
|
|
11
|
+
/>
|
|
4
12
|
</template>
|
|
5
13
|
|
|
6
14
|
<script>
|
|
@@ -9,7 +17,7 @@ export default {
|
|
|
9
17
|
data() {
|
|
10
18
|
return {
|
|
11
19
|
newStyleStr: '',
|
|
12
|
-
preview: true
|
|
20
|
+
preview: true
|
|
13
21
|
};
|
|
14
22
|
},
|
|
15
23
|
props: {
|
|
@@ -17,60 +25,42 @@ export default {
|
|
|
17
25
|
type: Object,
|
|
18
26
|
default() {
|
|
19
27
|
return {};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
22
30
|
},
|
|
23
31
|
methods: {
|
|
24
32
|
wxParseImgTap(e) {
|
|
25
33
|
if (!this.preview) return;
|
|
26
|
-
const {
|
|
27
|
-
src
|
|
28
|
-
} = e.currentTarget.dataset;
|
|
34
|
+
const { src } = e.currentTarget.dataset;
|
|
29
35
|
if (!src) return;
|
|
30
36
|
let parent = this.$parent;
|
|
31
|
-
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
37
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
38
|
+
// TODO 遍历获取父节点执行方法
|
|
32
39
|
parent = parent.$parent;
|
|
33
40
|
}
|
|
34
41
|
parent.preview(src, e);
|
|
35
42
|
},
|
|
36
43
|
// 图片视觉宽高计算函数区
|
|
37
44
|
wxParseImgLoad(e) {
|
|
38
|
-
const {
|
|
39
|
-
src
|
|
40
|
-
} = e.currentTarget.dataset;
|
|
45
|
+
const { src } = e.currentTarget.dataset;
|
|
41
46
|
if (!src) return;
|
|
42
|
-
const {
|
|
43
|
-
width,
|
|
44
|
-
height
|
|
45
|
-
} = e.mp.detail;
|
|
47
|
+
const { width, height } = e.mp.detail;
|
|
46
48
|
const recal = this.wxAutoImageCal(width, height);
|
|
47
|
-
const {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = recal;
|
|
51
|
-
const {
|
|
52
|
-
padding,
|
|
53
|
-
mode
|
|
54
|
-
} = this.node.attr;
|
|
55
|
-
const {
|
|
56
|
-
styleStr
|
|
57
|
-
} = this.node;
|
|
49
|
+
const { imageheight, imageWidth } = recal;
|
|
50
|
+
const { padding, mode } = this.node.attr;
|
|
51
|
+
const { styleStr } = this.node;
|
|
58
52
|
const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
|
|
59
53
|
this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`;
|
|
60
54
|
},
|
|
61
55
|
// 计算视觉优先的图片宽高
|
|
62
56
|
wxAutoImageCal(originalWidth, originalHeight) {
|
|
63
57
|
// 获取图片的原始长宽
|
|
64
|
-
const {
|
|
65
|
-
|
|
66
|
-
} = this.node.attr;
|
|
67
|
-
const windowWidth = this.node.$screen.width - (2 * padding);
|
|
58
|
+
const { padding } = this.node.attr;
|
|
59
|
+
const windowWidth = this.node.$screen.width - 2 * padding;
|
|
68
60
|
const results = {};
|
|
69
61
|
|
|
70
62
|
if (originalWidth < 60 || originalHeight < 60) {
|
|
71
|
-
const {
|
|
72
|
-
src
|
|
73
|
-
} = this.node.attr;
|
|
63
|
+
const { src } = this.node.attr;
|
|
74
64
|
let parent = this.$parent;
|
|
75
65
|
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
76
66
|
parent = parent.$parent;
|
|
@@ -91,7 +81,7 @@ export default {
|
|
|
91
81
|
}
|
|
92
82
|
|
|
93
83
|
return results;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
96
86
|
};
|
|
97
87
|
</script>
|
|
@@ -10,8 +10,8 @@ export default {
|
|
|
10
10
|
type: Object,
|
|
11
11
|
default() {
|
|
12
12
|
return {};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
15
|
},
|
|
16
16
|
data() {
|
|
17
17
|
return {
|
|
@@ -30,21 +30,21 @@ export default {
|
|
|
30
30
|
let t = {
|
|
31
31
|
name: children.tag,
|
|
32
32
|
attrs: {
|
|
33
|
-
class: children.classStr
|
|
33
|
+
class: children.classStr
|
|
34
34
|
// style: children.styleStr,
|
|
35
35
|
},
|
|
36
36
|
children: children.nodes ? this.loadNode(children.nodes) : []
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
|
|
39
|
-
obj.push(t)
|
|
39
|
+
obj.push(t);
|
|
40
40
|
} else if (children.node == 'text') {
|
|
41
41
|
obj.push({
|
|
42
42
|
type: 'text',
|
|
43
43
|
text: children.text
|
|
44
|
-
})
|
|
44
|
+
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
return obj
|
|
47
|
+
return obj;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
};
|
|
@@ -1,88 +1,105 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</block>
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view>
|
|
3
|
+
<!--判断是否是标签节点-->
|
|
4
|
+
<block v-if="node.node == 'element'">
|
|
5
|
+
<block v-if="node.tag == 'button'">
|
|
6
|
+
<button type="default" size="mini">
|
|
7
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
8
|
+
<wx-parse-template :node="node" />
|
|
9
|
+
</block>
|
|
10
|
+
</button>
|
|
11
|
+
</block>
|
|
12
|
+
|
|
13
|
+
<!--li类型-->
|
|
14
|
+
<block v-else-if="node.tag == 'li'">
|
|
15
|
+
<view :class="node.classStr" :style="node.styleStr">
|
|
16
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
17
|
+
<wx-parse-template :node="node" />
|
|
18
|
+
</block>
|
|
19
|
+
</view>
|
|
20
|
+
</block>
|
|
21
|
+
|
|
22
|
+
<!--video类型-->
|
|
23
|
+
<block v-else-if="node.tag == 'video'">
|
|
24
|
+
<wx-parse-video :node="node" />
|
|
25
|
+
</block>
|
|
26
|
+
|
|
27
|
+
<!--audio类型-->
|
|
28
|
+
<block v-else-if="node.tag == 'audio'">
|
|
29
|
+
<wx-parse-audio :node="node" />
|
|
30
|
+
</block>
|
|
31
|
+
|
|
32
|
+
<!--img类型-->
|
|
33
|
+
<block v-else-if="node.tag == 'img'">
|
|
34
|
+
<wx-parse-img :node="node" />
|
|
35
|
+
</block>
|
|
36
|
+
|
|
37
|
+
<!--a类型-->
|
|
38
|
+
<block v-else-if="node.tag == 'a'">
|
|
39
|
+
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
|
40
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
41
|
+
<wx-parse-template :node="node" />
|
|
42
|
+
</block>
|
|
43
|
+
</view>
|
|
44
|
+
</block>
|
|
45
|
+
|
|
46
|
+
<!--table类型-->
|
|
47
|
+
<block v-else-if="node.tag == 'table'">
|
|
48
|
+
<view :class="node.classStr" class="table" :style="node.styleStr">
|
|
49
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
50
|
+
<wx-parse-template :node="node" />
|
|
51
|
+
</block>
|
|
52
|
+
</view>
|
|
53
|
+
</block>
|
|
54
|
+
|
|
55
|
+
<!--br类型-->
|
|
56
|
+
<block v-else-if="node.tag == 'br'">
|
|
57
|
+
<text>\n</text>
|
|
58
|
+
</block>
|
|
59
|
+
|
|
60
|
+
<!--其他标签-->
|
|
61
|
+
<block v-else>
|
|
62
|
+
<view :class="node.classStr" :style="node.styleStr">
|
|
63
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
64
|
+
<wx-parse-template :node="node" />
|
|
65
|
+
</block>
|
|
66
|
+
</view>
|
|
67
|
+
</block>
|
|
68
|
+
</block>
|
|
69
|
+
|
|
70
|
+
<!--判断是否是文本节点-->
|
|
71
|
+
<block v-else-if="node.node == 'text'">{{ node.text }}</block>
|
|
72
|
+
</view>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import wxParseTemplate from './wxParseTemplate1';
|
|
77
|
+
import wxParseImg from './wxParseImg';
|
|
78
|
+
import wxParseVideo from './wxParseVideo';
|
|
79
|
+
import wxParseAudio from './wxParseAudio';
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
name: 'wxParseTemplate0',
|
|
83
|
+
props: {
|
|
84
|
+
node: {}
|
|
85
|
+
},
|
|
86
|
+
components: {
|
|
87
|
+
wxParseTemplate,
|
|
88
|
+
wxParseImg,
|
|
89
|
+
wxParseVideo,
|
|
90
|
+
wxParseAudio
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
wxParseATap(e) {
|
|
94
|
+
const { href } = e.currentTarget.dataset; // TODO currentTarget才有dataset
|
|
95
|
+
if (!href) return;
|
|
96
|
+
let parent = this.$parent;
|
|
97
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
98
|
+
// TODO 遍历获取父节点执行方法
|
|
99
|
+
parent = parent.$parent;
|
|
100
|
+
}
|
|
101
|
+
parent.navigate(href, e);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
@@ -1,88 +1,96 @@
|
|
|
1
|
-
<template>
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="node.tag == 'li' ? node.classStr : node.node === 'text' ? 'text' : ''">
|
|
3
|
+
<!--判断是否是标签节点-->
|
|
4
|
+
<block v-if="node.node == 'element'">
|
|
5
|
+
<block v-if="node.tag == 'button'">
|
|
6
|
+
<button type="default" size="mini">
|
|
7
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
8
|
+
<wx-parse-template :node="node" />
|
|
9
|
+
</block>
|
|
10
|
+
</button>
|
|
11
|
+
</block>
|
|
12
|
+
|
|
13
|
+
<!--li类型-->
|
|
14
|
+
<block v-else-if="node.tag == 'li'">
|
|
15
|
+
<!-- <view :class="node.classStr" :style="node.styleStr"> -->
|
|
16
|
+
<view :style="node.styleStr">
|
|
17
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
18
|
+
<wx-parse-template :node="node" />
|
|
19
|
+
</block>
|
|
20
|
+
</view>
|
|
21
|
+
</block>
|
|
22
|
+
|
|
23
|
+
<!--video类型-->
|
|
24
|
+
<block v-else-if="node.tag == 'video'">
|
|
25
|
+
<wx-parse-video :node="node" />
|
|
26
|
+
</block>
|
|
27
|
+
|
|
28
|
+
<!--audio类型-->
|
|
29
|
+
<block v-else-if="node.tag == 'audio'">
|
|
30
|
+
<wx-parse-audio :node="node" />
|
|
31
|
+
</block>
|
|
32
|
+
|
|
33
|
+
<!--img类型-->
|
|
34
|
+
<block v-else-if="node.tag == 'img'">
|
|
35
|
+
<wx-parse-img :node="node" />
|
|
36
|
+
</block>
|
|
37
|
+
|
|
38
|
+
<!--a类型-->
|
|
39
|
+
<block v-else-if="node.tag == 'a'">
|
|
40
|
+
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
|
41
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
42
|
+
<wx-parse-template :node="node" />
|
|
43
|
+
</block>
|
|
44
|
+
</view>
|
|
45
|
+
</block>
|
|
46
|
+
|
|
47
|
+
<!--br类型-->
|
|
48
|
+
<block v-else-if="node.tag == 'br'">
|
|
49
|
+
<text>\n</text>
|
|
50
|
+
</block>
|
|
51
|
+
|
|
52
|
+
<!--其他标签-->
|
|
53
|
+
<block v-else>
|
|
54
|
+
<view :class="node.classStr" :style="node.styleStr">
|
|
55
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
56
|
+
<wx-parse-template :node="node" />
|
|
57
|
+
</block>
|
|
58
|
+
</view>
|
|
59
|
+
</block>
|
|
60
|
+
</block>
|
|
61
|
+
|
|
62
|
+
<!--判断是否是文本节点-->
|
|
63
|
+
<block v-else-if="node.node == 'text'">{{ node.text }}</block>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
import wxParseTemplate from './wxParseTemplate2';
|
|
69
|
+
import wxParseImg from './wxParseImg';
|
|
70
|
+
import wxParseVideo from './wxParseVideo';
|
|
71
|
+
import wxParseAudio from './wxParseAudio';
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
name: 'wxParseTemplate1',
|
|
75
|
+
props: {
|
|
76
|
+
node: {}
|
|
77
|
+
},
|
|
78
|
+
components: {
|
|
79
|
+
wxParseTemplate,
|
|
80
|
+
wxParseImg,
|
|
81
|
+
wxParseVideo,
|
|
82
|
+
wxParseAudio
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
wxParseATap(e) {
|
|
86
|
+
const { href } = e.currentTarget.dataset;
|
|
87
|
+
if (!href) return;
|
|
88
|
+
let parent = this.$parent;
|
|
89
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
90
|
+
parent = parent.$parent;
|
|
91
|
+
}
|
|
92
|
+
parent.navigate(href, e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
</script>
|