wxParse.wxml 33 KB

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