Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
靖轩达人
uni-app
提交
8aec5d9e
U
uni-app
项目概览
靖轩达人
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8aec5d9e
编写于
11月 12, 2018
作者:
H
hulinneil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决 mpvue-wxparese 在h5上不能正确显示的问题
上级
19daafda
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
948 addition
and
899 deletion
+948
-899
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate0.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate0.vue
+87
-83
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate1.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate1.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate10.vue
...onents/mpvue-wxparse/src/components/wxParseTemplate10.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate11.vue
...onents/mpvue-wxparse/src/components/wxParseTemplate11.vue
+69
-65
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate2.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate2.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate3.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate3.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate4.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate4.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate5.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate5.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate6.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate6.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate7.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate7.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate8.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate8.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate9.vue
...ponents/mpvue-wxparse/src/components/wxParseTemplate9.vue
+79
-75
examples/hello-uniapp/components/mpvue-wxparse/src/wxParse.vue
...les/hello-uniapp/components/mpvue-wxparse/src/wxParse.vue
+2
-1
未找到文件。
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate0.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--table类型-->
<block
v-else-if=
"node.tag == 'table'"
>
<view
:class=
"node.classStr"
class=
"table"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--table类型-->
<block
v-else-if=
"node.tag == 'table'"
>
<view
:class=
"node.classStr"
class=
"table"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate1
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate1
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate0
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate0
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate1.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate2
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate2
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate1
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate1
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate10.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate11
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate11
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate10
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate10
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate11.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<!--button类型-->
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<!--button类型-->
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
{{
node
.
text
}}
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
{{
node
.
text
}}
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
{{
node
.
text
}}
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
{{
node
.
text
}}
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
{{
node
.
text
}}
</view>
</block>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
{{
node
.
text
}}
</view>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate11
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate11
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate2.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate3
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate3
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate2
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate2
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate3.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate4
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate4
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate3
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate3
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate4.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate5
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate5
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate4
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate4
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate5.vue
浏览文件 @
8aec5d9e
s
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate6
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate6
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate5
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate5
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate6.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate7
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate7
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate6
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate6
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate7.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate8
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate8
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate7
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate7
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate8.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate9
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate9
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate8
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate8
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/components/wxParseTemplate9.vue
浏览文件 @
8aec5d9e
<
template
>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<view>
<!--判断是否是标签节点-->
<block
v-if=
"node.node == 'element'"
>
<block
v-if=
"node.tag == 'button'"
>
<button
type=
"default"
size=
"mini"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</button>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--li类型-->
<block
v-else-if=
"node.tag == 'li'"
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--video类型-->
<block
v-else-if=
"node.tag == 'video'"
>
<wx-parse-video
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--audio类型-->
<block
v-else-if=
"node.tag == 'audio'"
>
<wx-parse-audio
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--img类型-->
<block
v-else-if=
"node.tag == 'img'"
>
<wx-parse-img
:node=
"node"
/>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--a类型-->
<block
v-else-if=
"node.tag == 'a'"
>
<view
@
click=
"wxParseATap"
:class=
"node.classStr"
:data-href=
"node.attr.href"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--br类型-->
<block
v-else-if=
"node.tag == 'br'"
>
<text>
\n
</text>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
<!--其他标签-->
<block
v-else
>
<view
:class=
"node.classStr"
:style=
"node.styleStr"
>
<block
v-for=
"(node, index) of node.nodes"
:key=
"index"
>
<wx-parse-template
:node=
"node"
/>
</block>
</view>
</block>
</block>
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
<!--判断是否是文本节点-->
<block
v-else-if=
"node.node == 'text'"
>
{{
node
.
text
}}
</block>
</view>
</
template
>
<
script
>
import
wxParseTemplate
from
'
./wxParseTemplate10
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
import
wxParseTemplate
from
'
./wxParseTemplate10
'
;
import
wxParseImg
from
'
./wxParseImg
'
;
import
wxParseVideo
from
'
./wxParseVideo
'
;
import
wxParseAudio
from
'
./wxParseAudio
'
;
export
default
{
name
:
'
wxParseTemplate9
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
export
default
{
name
:
'
wxParseTemplate9
'
,
props
:
{
node
:
{},
},
components
:
{
wxParseTemplate
,
wxParseImg
,
wxParseVideo
,
wxParseAudio
,
},
methods
:
{
wxParseATap
(
e
)
{
const
{
href
}
=
e
.
target
.
dataset
;
if
(
!
href
)
return
;
this
.
node
.
$host
.
navigate
(
href
,
e
);
},
},
};
</
script
>
examples/hello-uniapp/components/mpvue-wxparse/src/wxParse.vue
浏览文件 @
8aec5d9e
...
...
@@ -9,7 +9,7 @@
<
template
>
<!--基础元素-->
<div
class=
"wxParse"
:class=
"className"
v-if=
"!loading"
>
<block
v-for=
"
node of nodes"
:key=
"node.
index"
>
<block
v-for=
"
(node,index) of nodes"
:key=
"
index"
>
<wxParseTemplate
:node=
"node"
/>
</block>
</div>
...
...
@@ -93,6 +93,7 @@ export default {
};
const
results
=
HtmlToJson
(
parseData
,
customHandler
,
imageProp
,
this
);
this
.
imageUrls
=
results
.
imageUrls
;
console
.
log
(
results
)
return
results
.
nodes
;
},
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录