wxParse.wxml 39 KB

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