wxParse.wxml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. <!--**
  2. * author: Di (微信小程序开发工程师)
  3. * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
  4. * 垂直微信小程序开发交流社区
  5. *
  6. * github地址: https://github.com/icindy/wxParse
  7. *
  8. * for: 微信小程序富文本解析
  9. * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
  10. */-->
  11. <!--基础元素-->
  12. <template name="wxParseVideo">
  13. <!--增加video标签支持,并循环添加-->
  14. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  15. <video class="{{item.classStr}} wxParse-{{item.tag}}-video" src="{{item.attr.src}}"></video>
  16. </view>
  17. </template>
  18. <template name="wxParseImg">
  19. <image class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-src="{{item.attr.src}}" data-idx="{{item.imgIndex}}" src="{{item.attr.src}}" mode="aspectFit" bindload="wxParseImgLoad" bindtap="wxParseImgTap" style="width:{{item.width}}px;height:{{item.height}}px;{{item.attr.style}}" />
  20. </template>
  21. <template name="WxEmojiView">
  22. <view class="WxEmojiView wxParse-inline" style="{{item.styleStr}}">
  23. <block wx:for="{{item.textArray}}" wx:key="index">
  24. <block class="{{item.text == '\\n' ? 'wxParse-hide':''}}" wx:if="{{item.node == 'text'}}">{{item.text}}</block>
  25. <block wx:elif="{{item.node == 'element'}}">
  26. <image class="wxEmoji" src="{{item.baseSrc}}{{item.text}}" />
  27. </block>
  28. </block>
  29. </view>
  30. </template>
  31. <!--入口模版-->
  32. <template name="wxParse">
  33. <block wx:for="{{wxParseData}}" wx:key="index">
  34. <template is="wxParse0" data="{{item}}"/>
  35. </block>
  36. </template>
  37. <!--循环模版-->
  38. <template name="wxParse0">
  39. <!--<template is="wxParse1" data="{{item}}" />-->
  40. <!--判断是否是标签节点-->
  41. <block wx:if="{{item.node == 'element'}}">
  42. <block wx:if="{{item.tag == 'button'}}">
  43. <button type="default" size="mini" >
  44. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  45. <template is="wxParse1" data="{{item}}"/>
  46. </block>
  47. </button>
  48. </block>
  49. <!--li类型-->
  50. <block wx:elif="{{item.tag == 'li'}}">
  51. <view class="{{item.classStr}} wxParse-li">
  52. <view class="{{item.classStr}} wxParse-li-inner">
  53. <view class="{{item.classStr}} wxParse-li-text">
  54. <view class="{{item.classStr}} wxParse-li-circle"></view>
  55. </view>
  56. <view class="{{item.classStr}} wxParse-li-text">
  57. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  58. <template is="wxParse1" data="{{item}}"/>
  59. </block>
  60. </view>
  61. </view>
  62. </view>
  63. </block>
  64. <!--video类型-->
  65. <block wx:elif="{{item.tag == 'video'}}">
  66. <template is="wxParseVideo" data="{{item}}"/>
  67. </block>
  68. <!--img类型-->
  69. <block wx:elif="{{item.tag == 'img'}}">
  70. <template is="wxParseImg" data="{{item}}"/>
  71. </block>
  72. <!--a类型-->
  73. <block wx:elif="{{item.tag == 'a'}}">
  74. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-c="{{item.attr.href}}" style="{{item.styleStr}}">
  75. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  76. <template is="wxParse1" data="{{item}}"/>
  77. </block>
  78. </view>
  79. </block>
  80. <block wx:elif="{{item.tag == 'table'}}">
  81. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  82. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  83. <template is="wxParse1" data="{{item}}"/>
  84. </block>
  85. </view>
  86. </block>
  87. <!--其他块级标签-->
  88. <block wx:elif="{{item.tagType == 'block'}}">
  89. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  90. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  91. <template is="wxParse1" data="{{item}}"/>
  92. </block>
  93. </view>
  94. </block>
  95. <!--内联标签-->
  96. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  97. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  98. <template is="wxParse1" data="{{item}}"/>
  99. </block>
  100. </view>
  101. </block>
  102. <!--判断是否是文本节点-->
  103. <block wx:elif="{{item.node == 'text'}}">
  104. <!--如果是,直接进行-->
  105. <template is="WxEmojiView" data="{{item}}"/>
  106. </block>
  107. </template>
  108. <!--循环模版-->
  109. <template name="wxParse1">
  110. <!--<template is="wxParse2" data="{{item}}" />-->
  111. <!--判断是否是标签节点-->
  112. <block wx:if="{{item.node == 'element'}}">
  113. <block wx:if="{{item.tag == 'button'}}">
  114. <button type="default" size="mini" >
  115. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  116. <template is="wxParse2" data="{{item}}"/>
  117. </block>
  118. </button>
  119. </block>
  120. <!--li类型-->
  121. <block wx:elif="{{item.tag == 'li'}}">
  122. <view class="{{item.classStr}} wxParse-li">
  123. <view class="{{item.classStr}} wxParse-li-inner">
  124. <view class="{{item.classStr}} wxParse-li-text">
  125. <view class="{{item.classStr}} wxParse-li-circle"></view>
  126. </view>
  127. <view class="{{item.classStr}} wxParse-li-text">
  128. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  129. <template is="wxParse2" data="{{item}}"/>
  130. </block>
  131. </view>
  132. </view>
  133. </view>
  134. </block>
  135. <!--video类型-->
  136. <block wx:elif="{{item.tag == 'video'}}">
  137. <template is="wxParseVideo" data="{{item}}"/>
  138. </block>
  139. <!--img类型-->
  140. <block wx:elif="{{item.tag == 'img'}}">
  141. <template is="wxParseImg" data="{{item}}"/>
  142. </block>
  143. <!--a类型-->
  144. <block wx:elif="{{item.tag == 'a'}}">
  145. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  146. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  147. <template is="wxParse2" data="{{item}}"/>
  148. </block>
  149. </view>
  150. </block>
  151. <!--其他块级标签-->
  152. <block wx:elif="{{item.tagType == 'block'}}">
  153. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  154. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  155. <template is="wxParse2" data="{{item}}"/>
  156. </block>
  157. </view>
  158. </block>
  159. <!--内联标签-->
  160. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  161. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  162. <template is="wxParse2" data="{{item}}"/>
  163. </block>
  164. </view>
  165. </block>
  166. <!--判断是否是文本节点-->
  167. <block wx:elif="{{item.node == 'text'}}">
  168. <!--如果是,直接进行-->
  169. <template is="WxEmojiView" data="{{item}}"/>
  170. </block>
  171. </template>
  172. <!--循环模版-->
  173. <template name="wxParse2">
  174. <!--<template is="wxParse3" data="{{item}}" />-->
  175. <!--判断是否是标签节点-->
  176. <block wx:if="{{item.node == 'element'}}">
  177. <block wx:if="{{item.tag == 'button'}}">
  178. <button type="default" size="mini" >
  179. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  180. <template is="wxParse3" data="{{item}}"/>
  181. </block>
  182. </button>
  183. </block>
  184. <!--li类型-->
  185. <block wx:elif="{{item.tag == 'li'}}">
  186. <view class="{{item.classStr}} wxParse-li">
  187. <view class="{{item.classStr}} wxParse-li-inner">
  188. <view class="{{item.classStr}} wxParse-li-text">
  189. <view class="{{item.classStr}} wxParse-li-circle"></view>
  190. </view>
  191. <view class="{{item.classStr}} wxParse-li-text">
  192. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  193. <template is="wxParse3" data="{{item}}"/>
  194. </block>
  195. </view>
  196. </view>
  197. </view>
  198. </block>
  199. <!--video类型-->
  200. <block wx:elif="{{item.tag == 'video'}}">
  201. <template is="wxParseVideo" data="{{item}}"/>
  202. </block>
  203. <!--img类型-->
  204. <block wx:elif="{{item.tag == 'img'}}">
  205. <template is="wxParseImg" data="{{item}}"/>
  206. </block>
  207. <!--a类型-->
  208. <block wx:elif="{{item.tag == 'a'}}">
  209. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  210. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  211. <template is="wxParse3" data="{{item}}"/>
  212. </block>
  213. </view>
  214. </block>
  215. <!--其他块级标签-->
  216. <block wx:elif="{{item.tagType == 'block'}}">
  217. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  218. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  219. <template is="wxParse3" data="{{item}}"/>
  220. </block>
  221. </view>
  222. </block>
  223. <!--内联标签-->
  224. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  225. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  226. <template is="wxParse3" data="{{item}}"/>
  227. </block>
  228. </view>
  229. </block>
  230. <!--判断是否是文本节点-->
  231. <block wx:elif="{{item.node == 'text'}}">
  232. <!--如果是,直接进行-->
  233. <template is="WxEmojiView" data="{{item}}"/>
  234. </block>
  235. </template>
  236. <!--循环模版-->
  237. <template name="wxParse3">
  238. <!--<template is="wxParse4" data="{{item}}" />-->
  239. <!--判断是否是标签节点-->
  240. <block wx:if="{{item.node == 'element'}}">
  241. <block wx:if="{{item.tag == 'button'}}">
  242. <button type="default" size="mini" >
  243. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  244. <template is="wxParse4" data="{{item}}"/>
  245. </block>
  246. </button>
  247. </block>
  248. <!--li类型-->
  249. <block wx:elif="{{item.tag == 'li'}}">
  250. <view class="{{item.classStr}} wxParse-li">
  251. <view class="{{item.classStr}} wxParse-li-inner">
  252. <view class="{{item.classStr}} wxParse-li-text">
  253. <view class="{{item.classStr}} wxParse-li-circle"></view>
  254. </view>
  255. <view class="{{item.classStr}} wxParse-li-text">
  256. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  257. <template is="wxParse4" data="{{item}}"/>
  258. </block>
  259. </view>
  260. </view>
  261. </view>
  262. </block>
  263. <!--video类型-->
  264. <block wx:elif="{{item.tag == 'video'}}">
  265. <template is="wxParseVideo" data="{{item}}"/>
  266. </block>
  267. <!--img类型-->
  268. <block wx:elif="{{item.tag == 'img'}}">
  269. <template is="wxParseImg" data="{{item}}"/>
  270. </block>
  271. <!--a类型-->
  272. <block wx:elif="{{item.tag == 'a'}}">
  273. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  274. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  275. <template is="wxParse4" data="{{item}}"/>
  276. </block>
  277. </view>
  278. </block>
  279. <!--其他块级标签-->
  280. <block wx:elif="{{item.tagType == 'block'}}">
  281. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  282. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  283. <template is="wxParse4" data="{{item}}"/>
  284. </block>
  285. </view>
  286. </block>
  287. <!--内联标签-->
  288. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  289. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  290. <template is="wxParse4" data="{{item}}"/>
  291. </block>
  292. </view>
  293. </block>
  294. <!--判断是否是文本节点-->
  295. <block wx:elif="{{item.node == 'text'}}">
  296. <!--如果是,直接进行-->
  297. <template is="WxEmojiView" data="{{item}}"/>
  298. </block>
  299. </template>
  300. <!--循环模版-->
  301. <template name="wxParse4">
  302. <!--<template is="wxParse5" data="{{item}}" />-->
  303. <!--判断是否是标签节点-->
  304. <block wx:if="{{item.node == 'element'}}">
  305. <block wx:if="{{item.tag == 'button'}}">
  306. <button type="default" size="mini" >
  307. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  308. <template is="wxParse5" data="{{item}}"/>
  309. </block>
  310. </button>
  311. </block>
  312. <!--li类型-->
  313. <block wx:elif="{{item.tag == 'li'}}">
  314. <view class="{{item.classStr}} wxParse-li">
  315. <view class="{{item.classStr}} wxParse-li-inner">
  316. <view class="{{item.classStr}} wxParse-li-text">
  317. <view class="{{item.classStr}} wxParse-li-circle"></view>
  318. </view>
  319. <view class="{{item.classStr}} wxParse-li-text">
  320. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  321. <template is="wxParse5" data="{{item}}"/>
  322. </block>
  323. </view>
  324. </view>
  325. </view>
  326. </block>
  327. <!--video类型-->
  328. <block wx:elif="{{item.tag == 'video'}}">
  329. <template is="wxParseVideo" data="{{item}}"/>
  330. </block>
  331. <!--img类型-->
  332. <block wx:elif="{{item.tag == 'img'}}">
  333. <template is="wxParseImg" data="{{item}}"/>
  334. </block>
  335. <!--a类型-->
  336. <block wx:elif="{{item.tag == 'a'}}">
  337. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  338. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  339. <template is="wxParse5" data="{{item}}"/>
  340. </block>
  341. </view>
  342. </block>
  343. <!--其他块级标签-->
  344. <block wx:elif="{{item.tagType == 'block'}}">
  345. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  346. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  347. <template is="wxParse5" data="{{item}}"/>
  348. </block>
  349. </view>
  350. </block>
  351. <!--内联标签-->
  352. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  353. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  354. <template is="wxParse5" data="{{item}}"/>
  355. </block>
  356. </view>
  357. </block>
  358. <!--判断是否是文本节点-->
  359. <block wx:elif="{{item.node == 'text'}}">
  360. <!--如果是,直接进行-->
  361. <template is="WxEmojiView" data="{{item}}"/>
  362. </block>
  363. </template>
  364. <!--循环模版-->
  365. <template name="wxParse5">
  366. <!--<template is="wxParse6" data="{{item}}" />-->
  367. <!--判断是否是标签节点-->
  368. <block wx:if="{{item.node == 'element'}}">
  369. <block wx:if="{{item.tag == 'button'}}">
  370. <button type="default" size="mini" >
  371. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  372. <template is="wxParse6" data="{{item}}"/>
  373. </block>
  374. </button>
  375. </block>
  376. <!--li类型-->
  377. <block wx:elif="{{item.tag == 'li'}}">
  378. <view class="{{item.classStr}} wxParse-li">
  379. <view class="{{item.classStr}} wxParse-li-inner">
  380. <view class="{{item.classStr}} wxParse-li-text">
  381. <view class="{{item.classStr}} wxParse-li-circle"></view>
  382. </view>
  383. <view class="{{item.classStr}} wxParse-li-text">
  384. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  385. <template is="wxParse6" data="{{item}}"/>
  386. </block>
  387. </view>
  388. </view>
  389. </view>
  390. </block>
  391. <!--video类型-->
  392. <block wx:elif="{{item.tag == 'video'}}">
  393. <template is="wxParseVideo" data="{{item}}"/>
  394. </block>
  395. <!--img类型-->
  396. <block wx:elif="{{item.tag == 'img'}}">
  397. <template is="wxParseImg" data="{{item}}"/>
  398. </block>
  399. <!--a类型-->
  400. <block wx:elif="{{item.tag == 'a'}}">
  401. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  402. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  403. <template is="wxParse6" data="{{item}}"/>
  404. </block>
  405. </view>
  406. </block>
  407. <!--其他块级标签-->
  408. <block wx:elif="{{item.tagType == 'block'}}">
  409. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  410. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  411. <template is="wxParse6" data="{{item}}"/>
  412. </block>
  413. </view>
  414. </block>
  415. <!--内联标签-->
  416. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  417. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  418. <template is="wxParse6" data="{{item}}"/>
  419. </block>
  420. </view>
  421. </block>
  422. <!--判断是否是文本节点-->
  423. <block wx:elif="{{item.node == 'text'}}">
  424. <!--如果是,直接进行-->
  425. <template is="WxEmojiView" data="{{item}}"/>
  426. </block>
  427. </template>
  428. <!--循环模版-->
  429. <template name="wxParse6">
  430. <!--<template is="wxParse7" data="{{item}}" />-->
  431. <!--判断是否是标签节点-->
  432. <block wx:if="{{item.node == 'element'}}">
  433. <block wx:if="{{item.tag == 'button'}}">
  434. <button type="default" size="mini" >
  435. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  436. <template is="wxParse7" data="{{item}}"/>
  437. </block>
  438. </button>
  439. </block>
  440. <!--li类型-->
  441. <block wx:elif="{{item.tag == 'li'}}">
  442. <view class="{{item.classStr}} wxParse-li">
  443. <view class="{{item.classStr}} wxParse-li-inner">
  444. <view class="{{item.classStr}} wxParse-li-text">
  445. <view class="{{item.classStr}} wxParse-li-circle"></view>
  446. </view>
  447. <view class="{{item.classStr}} wxParse-li-text">
  448. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  449. <template is="wxParse7" data="{{item}}"/>
  450. </block>
  451. </view>
  452. </view>
  453. </view>
  454. </block>
  455. <!--video类型-->
  456. <block wx:elif="{{item.tag == 'video'}}">
  457. <template is="wxParseVideo" data="{{item}}"/>
  458. </block>
  459. <!--img类型-->
  460. <block wx:elif="{{item.tag == 'img'}}">
  461. <template is="wxParseImg" data="{{item}}"/>
  462. </block>
  463. <!--a类型-->
  464. <block wx:elif="{{item.tag == 'a'}}">
  465. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  466. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  467. <template is="wxParse7" data="{{item}}"/>
  468. </block>
  469. </view>
  470. </block>
  471. <!--其他块级标签-->
  472. <block wx:elif="{{item.tagType == 'block'}}">
  473. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  474. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  475. <template is="wxParse7" data="{{item}}"/>
  476. </block>
  477. </view>
  478. </block>
  479. <!--内联标签-->
  480. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  481. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  482. <template is="wxParse7" data="{{item}}"/>
  483. </block>
  484. </view>
  485. </block>
  486. <!--判断是否是文本节点-->
  487. <block wx:elif="{{item.node == 'text'}}">
  488. <!--如果是,直接进行-->
  489. <template is="WxEmojiView" data="{{item}}"/>
  490. </block>
  491. </template>
  492. <!--循环模版-->
  493. <template name="wxParse7">
  494. <!--<template is="wxParse8" data="{{item}}" />-->
  495. <!--判断是否是标签节点-->
  496. <block wx:if="{{item.node == 'element'}}">
  497. <block wx:if="{{item.tag == 'button'}}">
  498. <button type="default" size="mini" >
  499. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  500. <template is="wxParse8" data="{{item}}"/>
  501. </block>
  502. </button>
  503. </block>
  504. <!--li类型-->
  505. <block wx:elif="{{item.tag == 'li'}}">
  506. <view class="{{item.classStr}} wxParse-li">
  507. <view class="{{item.classStr}} wxParse-li-inner">
  508. <view class="{{item.classStr}} wxParse-li-text">
  509. <view class="{{item.classStr}} wxParse-li-circle"></view>
  510. </view>
  511. <view class="{{item.classStr}} wxParse-li-text">
  512. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  513. <template is="wxParse8" data="{{item}}"/>
  514. </block>
  515. </view>
  516. </view>
  517. </view>
  518. </block>
  519. <!--video类型-->
  520. <block wx:elif="{{item.tag == 'video'}}">
  521. <template is="wxParseVideo" data="{{item}}"/>
  522. </block>
  523. <!--img类型-->
  524. <block wx:elif="{{item.tag == 'img'}}">
  525. <template is="wxParseImg" data="{{item}}"/>
  526. </block>
  527. <!--a类型-->
  528. <block wx:elif="{{item.tag == 'a'}}">
  529. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  530. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  531. <template is="wxParse8" data="{{item}}"/>
  532. </block>
  533. </view>
  534. </block>
  535. <!--其他块级标签-->
  536. <block wx:elif="{{item.tagType == 'block'}}">
  537. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  538. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  539. <template is="wxParse8" data="{{item}}"/>
  540. </block>
  541. </view>
  542. </block>
  543. <!--内联标签-->
  544. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  545. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  546. <template is="wxParse8" data="{{item}}"/>
  547. </block>
  548. </view>
  549. </block>
  550. <!--判断是否是文本节点-->
  551. <block wx:elif="{{item.node == 'text'}}">
  552. <!--如果是,直接进行-->
  553. <template is="WxEmojiView" data="{{item}}"/>
  554. </block>
  555. </template>
  556. <!--循环模版-->
  557. <template name="wxParse8">
  558. <!--<template is="wxParse9" data="{{item}}" />-->
  559. <!--判断是否是标签节点-->
  560. <block wx:if="{{item.node == 'element'}}">
  561. <block wx:if="{{item.tag == 'button'}}">
  562. <button type="default" size="mini" >
  563. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  564. <template is="wxParse9" data="{{item}}"/>
  565. </block>
  566. </button>
  567. </block>
  568. <!--li类型-->
  569. <block wx:elif="{{item.tag == 'li'}}">
  570. <view class="{{item.classStr}} wxParse-li">
  571. <view class="{{item.classStr}} wxParse-li-inner">
  572. <view class="{{item.classStr}} wxParse-li-text">
  573. <view class="{{item.classStr}} wxParse-li-circle"></view>
  574. </view>
  575. <view class="{{item.classStr}} wxParse-li-text">
  576. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  577. <template is="wxParse9" data="{{item}}"/>
  578. </block>
  579. </view>
  580. </view>
  581. </view>
  582. </block>
  583. <!--video类型-->
  584. <block wx:elif="{{item.tag == 'video'}}">
  585. <template is="wxParseVideo" data="{{item}}"/>
  586. </block>
  587. <!--img类型-->
  588. <block wx:elif="{{item.tag == 'img'}}">
  589. <template is="wxParseImg" data="{{item}}"/>
  590. </block>
  591. <!--a类型-->
  592. <block wx:elif="{{item.tag == 'a'}}">
  593. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  594. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  595. <template is="wxParse9" data="{{item}}"/>
  596. </block>
  597. </view>
  598. </block>
  599. <!--其他块级标签-->
  600. <block wx:elif="{{item.tagType == 'block'}}">
  601. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  602. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  603. <template is="wxParse9" data="{{item}}"/>
  604. </block>
  605. </view>
  606. </block>
  607. <!--内联标签-->
  608. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  609. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  610. <template is="wxParse9" data="{{item}}"/>
  611. </block>
  612. </view>
  613. </block>
  614. <!--判断是否是文本节点-->
  615. <block wx:elif="{{item.node == 'text'}}">
  616. <!--如果是,直接进行-->
  617. <template is="WxEmojiView" data="{{item}}"/>
  618. </block>
  619. </template>
  620. <!--循环模版-->
  621. <template name="wxParse9">
  622. <!--<template is="wxParse10" data="{{item}}" />-->
  623. <!--判断是否是标签节点-->
  624. <block wx:if="{{item.node == 'element'}}">
  625. <block wx:if="{{item.tag == 'button'}}">
  626. <button type="default" size="mini" >
  627. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  628. <template is="wxParse10" data="{{item}}"/>
  629. </block>
  630. </button>
  631. </block>
  632. <!--li类型-->
  633. <block wx:elif="{{item.tag == 'li'}}">
  634. <view class="{{item.classStr}} wxParse-li">
  635. <view class="{{item.classStr}} wxParse-li-inner">
  636. <view class="{{item.classStr}} wxParse-li-text">
  637. <view class="{{item.classStr}} wxParse-li-circle"></view>
  638. </view>
  639. <view class="{{item.classStr}} wxParse-li-text">
  640. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  641. <template is="wxParse10" data="{{item}}"/>
  642. </block>
  643. </view>
  644. </view>
  645. </view>
  646. </block>
  647. <!--video类型-->
  648. <block wx:elif="{{item.tag == 'video'}}">
  649. <template is="wxParseVideo" data="{{item}}"/>
  650. </block>
  651. <!--img类型-->
  652. <block wx:elif="{{item.tag == 'img'}}">
  653. <template is="wxParseImg" data="{{item}}"/>
  654. </block>
  655. <!--a类型-->
  656. <block wx:elif="{{item.tag == 'a'}}">
  657. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  658. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  659. <template is="wxParse10" data="{{item}}"/>
  660. </block>
  661. </view>
  662. </block>
  663. <!--其他块级标签-->
  664. <block wx:elif="{{item.tagType == 'block'}}">
  665. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  666. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  667. <template is="wxParse10" data="{{item}}"/>
  668. </block>
  669. </view>
  670. </block>
  671. <!--内联标签-->
  672. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  673. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  674. <template is="wxParse10" data="{{item}}"/>
  675. </block>
  676. </view>
  677. </block>
  678. <!--判断是否是文本节点-->
  679. <block wx:elif="{{item.node == 'text'}}">
  680. <!--如果是,直接进行-->
  681. <template is="WxEmojiView" data="{{item}}"/>
  682. </block>
  683. </template>
  684. <!--循环模版-->
  685. <template name="wxParse10">
  686. <!--<template is="wxParse11" data="{{item}}" />-->
  687. <!--判断是否是标签节点-->
  688. <block wx:if="{{item.node == 'element'}}">
  689. <block wx:if="{{item.tag == 'button'}}">
  690. <button type="default" size="mini" >
  691. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  692. <template is="wxParse11" data="{{item}}"/>
  693. </block>
  694. </button>
  695. </block>
  696. <!--li类型-->
  697. <block wx:elif="{{item.tag == 'li'}}">
  698. <view class="{{item.classStr}} wxParse-li">
  699. <view class="{{item.classStr}} wxParse-li-inner">
  700. <view class="{{item.classStr}} wxParse-li-text">
  701. <view class="{{item.classStr}} wxParse-li-circle"></view>
  702. </view>
  703. <view class="{{item.classStr}} wxParse-li-text">
  704. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  705. <template is="wxParse11" data="{{item}}"/>
  706. </block>
  707. </view>
  708. </view>
  709. </view>
  710. </block>
  711. <!--video类型-->
  712. <block wx:elif="{{item.tag == 'video'}}">
  713. <template is="wxParseVideo" data="{{item}}"/>
  714. </block>
  715. <!--img类型-->
  716. <block wx:elif="{{item.tag == 'img'}}">
  717. <template is="wxParseImg" data="{{item}}"/>
  718. </block>
  719. <!--a类型-->
  720. <block wx:elif="{{item.tag == 'a'}}">
  721. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  722. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  723. <template is="wxParse11" data="{{item}}"/>
  724. </block>
  725. </view>
  726. </block>
  727. <!--其他块级标签-->
  728. <block wx:elif="{{item.tagType == 'block'}}">
  729. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  730. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  731. <template is="wxParse11" data="{{item}}"/>
  732. </block>
  733. </view>
  734. </block>
  735. <!--内联标签-->
  736. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  737. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  738. <template is="wxParse11" data="{{item}}"/>
  739. </block>
  740. </view>
  741. </block>
  742. <!--判断是否是文本节点-->
  743. <block wx:elif="{{item.node == 'text'}}">
  744. <!--如果是,直接进行-->
  745. <template is="WxEmojiView" data="{{item}}"/>
  746. </block>
  747. </template>
  748. <!--循环模版-->
  749. <template name="wxParse11">
  750. <!--<template is="wxParse12" data="{{item}}" />-->
  751. <!--判断是否是标签节点-->
  752. <block wx:if="{{item.node == 'element'}}">
  753. <block wx:if="{{item.tag == 'button'}}">
  754. <button type="default" size="mini" >
  755. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  756. <template is="wxParse12" data="{{item}}"/>
  757. </block>
  758. </button>
  759. </block>
  760. <!--li类型-->
  761. <block wx:elif="{{item.tag == 'li'}}">
  762. <view class="{{item.classStr}} wxParse-li">
  763. <view class="{{item.classStr}} wxParse-li-inner">
  764. <view class="{{item.classStr}} wxParse-li-text">
  765. <view class="{{item.classStr}} wxParse-li-circle"></view>
  766. </view>
  767. <view class="{{item.classStr}} wxParse-li-text">
  768. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  769. <template is="wxParse12" data="{{item}}"/>
  770. </block>
  771. </view>
  772. </view>
  773. </view>
  774. </block>
  775. <!--video类型-->
  776. <block wx:elif="{{item.tag == 'video'}}">
  777. <template is="wxParseVideo" data="{{item}}"/>
  778. </block>
  779. <!--img类型-->
  780. <block wx:elif="{{item.tag == 'img'}}">
  781. <template is="wxParseImg" data="{{item}}"/>
  782. </block>
  783. <!--a类型-->
  784. <block wx:elif="{{item.tag == 'a'}}">
  785. <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
  786. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  787. <template is="wxParse12" data="{{item}}"/>
  788. </block>
  789. </view>
  790. </block>
  791. <!--其他块级标签-->
  792. <block wx:elif="{{item.tagType == 'block'}}">
  793. <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
  794. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  795. <template is="wxParse12" data="{{item}}"/>
  796. </block>
  797. </view>
  798. </block>
  799. <!--内联标签-->
  800. <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
  801. <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
  802. <template is="wxParse12" data="{{item}}"/>
  803. </block>
  804. </view>
  805. </block>
  806. <!--判断是否是文本节点-->
  807. <block wx:elif="{{item.node == 'text'}}">
  808. <!--如果是,直接进行-->
  809. <template is="WxEmojiView" data="{{item}}"/>
  810. </block>
  811. </template>