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.

74 lines
2.5 KiB

3 years ago
<template name="wxParse1">
<!--<template is="wxParse2" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block v-if="item.node == 'element'">
<block v-if="item.tag == 'button'">
<button type="default" size="mini">
<block v-for="(item, index) in item.nodes" :key="index">
<template is="wxParse2" :data="item"></template>
</block>
</button>
</block>
<!--li类型-->
<block v-else-if="item.tag == 'li'">
<view :class="item.classStr + ' wxParse-li'" :style="item.styleStr">
<view :class="item.classStr + ' wxParse-li-inner'">
<view :class="item.classStr + ' wxParse-li-text'">
<view :class="item.classStr + ' wxParse-li-circle'"></view>
</view>
<view :class="item.classStr + ' wxParse-li-text'">
<block v-for="(item, index) in item.nodes" :key="index">
<template is="wxParse2" :data="item"></template>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block v-else-if="item.tag == 'video'">
<template is="wxParseVideo" :data="item"></template>
</block>
<!--img类型-->
<block v-else-if="item.tag == 'img'">
<template is="wxParseImg" :data="item"></template>
</block>
<!--a类型-->
<block v-else-if="item.tag == 'a'">
<view @tap="wxParseTagATap" :class="'wxParse-inline ' + item.classStr + ' wxParse-' + item.tag" :data-src="item.attr.href" :style="item.styleStr">
<block v-for="(item, index) in item.nodes" :key="index">
<template is="wxParse2" :data="item"></template>
</block>
</view>
</block>
<block v-else-if="item.tag == 'br'">
<template is="WxParseBr"></template>
</block>
<!--其他块级标签-->
<block v-else-if="item.tagType == 'block'">
<view :class="item.classStr + ' wxParse-' + item.tag" :style="item.styleStr">
<block v-for="(item, index) in item.nodes" :key="index">
<template is="wxParse2" :data="item"></template>
</block>
</view>
</block>
<!--内联标签-->
<view v-else :class="item.classStr + ' wxParse-' + item.tag + ' wxParse-' + item.tagType" :style="item.styleStr">
<block v-for="(item, index) in item.nodes" :key="index">
<template is="wxParse2" :data="item"></template>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block v-else-if="item.node == 'text'">
<!--如果是直接进行-->
<template is="WxEmojiView" :data="item"></template>
</block>
</template>