node.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
  1. <template>
  2. <view :id="attrs.id" :class="'_block _' + name + ' ' + attrs.class" :style="attrs.style">
  3. <block v-for="(n, i) in childs" v-bind:key="i">
  4. <!-- 图片 -->
  5. <!-- 占位图 -->
  6. <image v-if="n.name === 'img' && !n.t && ((opts[1] && !ctrl[i]) || ctrl[i] < 0)" class="_img"
  7. :style="n.attrs.style" :src="ctrl[i] < 0 ? opts[2] : opts[1]" mode="widthFix" />
  8. <!-- 显示图片 -->
  9. <!-- #ifdef H5 || (APP-PLUS && VUE2) -->
  10. <img v-if="n.name === 'img'" :id="n.attrs.id" :class="'_img ' + n.attrs.class"
  11. :style="(ctrl[i] === -1 ? 'display:none;' : '') + n.attrs.style"
  12. :src="n.attrs.src || (ctrl.load ? n.attrs['data-src'] : '')" :data-i="i" @load="imgLoad" @error="mediaError"
  13. @tap.stop="imgTap" @longpress="imgLongTap" />
  14. <!-- #endif -->
  15. <!-- #ifndef H5 || (APP-PLUS && VUE2) -->
  16. <!-- 表格中的图片,使用 rich-text 防止大小不正确 -->
  17. <rich-text v-if="n.name === 'img' && n.t" :style="'display:' + n.t"
  18. :nodes="[{ attrs: { style: n.attrs.style, src: n.attrs.src }, name: 'img' }]" :data-i="i" @tap.stop="imgTap" />
  19. <!-- #endif -->
  20. <!-- #ifndef H5 || APP-PLUS -->
  21. <image v-else-if="n.name === 'img'" :id="n.attrs.id" :class="'_img ' + n.attrs.class"
  22. :style="(ctrl[i] === -1 ? 'display:none;' : '') + 'width:' + (ctrl[i] || 1) + 'px;height:1px;' + n.attrs.style"
  23. :src="n.attrs.src" :mode="!n.h ? 'widthFix' : (!n.w ? 'heightFix' : '')" :lazy-load="opts[0]" :webp="n.webp"
  24. :show-menu-by-longpress="opts[3] && !n.attrs.ignore" :image-menu-prevent="!opts[3] || n.attrs.ignore"
  25. :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
  26. <!-- #endif -->
  27. <!-- #ifdef APP-PLUS && VUE3 -->
  28. <image v-else-if="n.name === 'img'" :id="n.attrs.id" :class="'_img ' + n.attrs.class"
  29. :style="(ctrl[i] === -1 ? 'display:none;' : '') + 'width:' + (ctrl[i] || 1) + 'px;' + n.attrs.style"
  30. :src="n.attrs.src || (ctrl.load ? n.attrs['data-src'] : '')"
  31. :mode="!n.h ? 'widthFix' : (!n.w ? 'heightFix' : '')" :data-i="i" @load="imgLoad" @error="mediaError"
  32. @tap.stop="imgTap" @longpress="imgLongTap" />
  33. <!-- #endif -->
  34. <!-- 文本 -->
  35. <!-- #ifdef MP-WEIXIN -->
  36. <text v-else-if="n.text" :user-select="opts[4] == 'force' && isiOS" decode>{{ n.text }}</text>
  37. <!-- #endif -->
  38. <!-- #ifndef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-TOUTIAO -->
  39. <text v-else-if="n.text" decode>{{ n.text }}</text>
  40. <!-- #endif -->
  41. <text v-else-if="n.name === 'br'">\n</text>
  42. <!-- 链接 -->
  43. <view v-else-if="n.name === 'a'" :id="n.attrs.id"
  44. :class="[(n.attrs.href ? '_a ' : '') + n.attrs.class, (n.attrs['data-value'] ? '_ab ' : '')]"
  45. hover-class="_hover" :style="'display:inline;' + n.attrs.style" :data-i="i" @tap.stop="linkTap">
  46. <node name="span" :childs="n.children" :opts="opts" style="display:inherit" />
  47. </view>
  48. <!-- 视频 -->
  49. <!-- #ifdef APP-PLUS -->
  50. <view v-else-if="n.html" :id="n.attrs.id" :class="'_video ' + n.attrs.class" :style="n.attrs.style"
  51. v-html="n.html" @vplay.stop="play" />
  52. <!-- #endif -->
  53. <!-- #ifndef APP-PLUS -->
  54. <video v-else-if="n.name === 'video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style"
  55. :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted"
  56. :object-fit="n.attrs['object-fit']" :poster="n.attrs.poster" :src="n.src[ctrl[i] || 0]" :data-i="i" @play="play"
  57. @error="mediaError" />
  58. <!-- #endif -->
  59. <!-- #ifdef H5 || APP-PLUS -->
  60. <iframe v-else-if="n.name === 'iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen"
  61. :frameborder="n.attrs.frameborder" :src="n.attrs.src" />
  62. <embed v-else-if="n.name === 'embed'" :style="n.attrs.style" :src="n.attrs.src" />
  63. <!-- #endif -->
  64. <!-- #ifndef MP-TOUTIAO || ((H5 || APP-PLUS) && VUE3) -->
  65. <!-- 音频 -->
  66. <audio v-else-if="n.name === 'audio'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style"
  67. :author="n.attrs.author" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name"
  68. :poster="n.attrs.poster" :src="n.src[ctrl[i] || 0]" :data-i="i" @play="play" @error="mediaError" />
  69. <!-- #endif -->
  70. <view v-else-if="(n.name === 'table' && n.c) || n.name === 'li'" :id="n.attrs.id"
  71. :class="'_' + n.name + ' ' + n.attrs.class" :style="n.attrs.style">
  72. <node v-if="n.name === 'li'" :childs="n.children" :opts="opts" />
  73. <view v-else v-for="(tbody, x) in n.children" v-bind:key="x" :class="'_' + tbody.name + ' ' + tbody.attrs.class"
  74. :style="tbody.attrs.style">
  75. <node v-if="tbody.name === 'td' || tbody.name === 'th'" :childs="tbody.children" :opts="opts" />
  76. <block v-else v-for="(tr, y) in tbody.children" v-bind:key="y">
  77. <view v-if="tr.name === 'td' || tr.name === 'th'" :class="'_' + tr.name + ' ' + tr.attrs.class"
  78. :style="tr.attrs.style">
  79. <node :childs="tr.children" :opts="opts" />
  80. </view>
  81. <view v-else :class="'_' + tr.name + ' ' + tr.attrs.class" :style="tr.attrs.style">
  82. <view v-for="(td, z) in tr.children" v-bind:key="z" :class="'_' + td.name + ' ' + td.attrs.class"
  83. :style="td.attrs.style">
  84. <node :childs="td.children" :opts="opts" />
  85. </view>
  86. </view>
  87. </block>
  88. </view>
  89. </view>
  90. <!-- 富文本 -->
  91. <!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
  92. <rich-text v-else-if="!n.c && !handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f"
  93. :user-select="opts[4]" :nodes="[n]" @tap.stop="codeLongTap(n)" />
  94. <!-- #endif -->
  95. <!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
  96. <rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;' + n.f" :preview="false"
  97. :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" @tap.stop="codeLongTap(n)" />
  98. <!-- #endif -->
  99. <!-- 继续递归 -->
  100. <view v-else-if="n.c === 2" :id="n.attrs.id" :class="'_block _' + n.name + ' ' + n.attrs.class"
  101. :style="n.f + ';' + n.attrs.style">
  102. <node v-for="(n2, j) in n.children" v-bind:key="j" :style="n2.f" :name="n2.name" :attrs="n2.attrs"
  103. :childs="n2.children" :opts="opts" />
  104. </view>
  105. <node v-else :style="n.f" :name="n.name" :attrs="n.attrs" :childs="n.children" :opts="opts" />
  106. </block>
  107. </view>
  108. </template>
  109. <script module="handler" lang="wxs">
  110. // 行内标签列表
  111. var inlineTags = {
  112. abbr: true,
  113. b: true,
  114. big: true,
  115. code: true,
  116. del: true,
  117. em: true,
  118. i: true,
  119. ins: true,
  120. label: true,
  121. q: true,
  122. small: true,
  123. span: true,
  124. strong: true,
  125. sub: true,
  126. sup: true
  127. }
  128. /**
  129. * @description 判断是否为行内标签
  130. */
  131. module.exports = {
  132. isInline: function (tagName, style) {
  133. return inlineTags[tagName] || (style || '').indexOf('display:inline') !== -1
  134. }
  135. }
  136. </script>
  137. <script>
  138. import node from './node'
  139. export default {
  140. name: 'node',
  141. options: {
  142. // #ifdef MP-WEIXIN
  143. virtualHost: true,
  144. // #endif
  145. // #ifdef MP-TOUTIAO
  146. addGlobalClass: false
  147. // #endif
  148. },
  149. data () {
  150. return {
  151. ctrl: {},
  152. // #ifdef MP-WEIXIN
  153. isiOS: uni.getSystemInfoSync().system.includes('iOS')
  154. // #endif
  155. }
  156. },
  157. props: {
  158. name: String,
  159. attrs: {
  160. type: Object,
  161. default () {
  162. return {}
  163. }
  164. },
  165. childs: Array,
  166. opts: Array
  167. },
  168. components: {
  169. // #ifndef (H5 || APP-PLUS) && VUE3
  170. node
  171. // #endif
  172. },
  173. mounted () {
  174. this.$nextTick(() => {
  175. for (this.root = this.$parent; this.root.$options.name !== 'mp-html'; this.root = this.root.$parent);
  176. })
  177. // #ifdef H5 || APP-PLUS
  178. if (this.opts[0]) {
  179. let i
  180. for (i = this.childs.length; i--;) {
  181. if (this.childs[i].name === 'img') break
  182. }
  183. if (i !== -1) {
  184. this.observer = uni.createIntersectionObserver(this).relativeToViewport({
  185. top: 500,
  186. bottom: 500
  187. })
  188. this.observer.observe('._img', res => {
  189. if (res.intersectionRatio) {
  190. this.$set(this.ctrl, 'load', 1)
  191. this.observer.disconnect()
  192. }
  193. })
  194. }
  195. }
  196. // #endif
  197. },
  198. beforeDestroy () {
  199. // #ifdef H5 || APP-PLUS
  200. if (this.observer) {
  201. this.observer.disconnect()
  202. }
  203. // #endif
  204. },
  205. methods:{
  206. codeLongTap(e){
  207. if(e.attrs.class=='hl-pre'){
  208. uni.setClipboardData({
  209. data: e.attrs['data-content'],
  210. showToast:false,
  211. success: () => {
  212. uni.showToast({
  213. title: '代码复制成功',
  214. duration: 1000
  215. });
  216. },
  217. fail: (err) => {
  218. console.log('err', err);
  219. }
  220. });
  221. }
  222. },
  223. // codeLongTap(e){
  224. // console.log('codeLongTap',e.attrs);
  225. // if(e.attrs.class=='hl-pre'){
  226. // uni.showActionSheet({
  227. // itemList: ['复制代码'],
  228. // success: function (res) {
  229. // uni.setClipboardData({
  230. // data: e.attrs['data-content'],
  231. // showToast:false,
  232. // success: () => {
  233. // uni.showToast({
  234. // title: '代码复制成功',
  235. // duration: 1000
  236. // });
  237. // },
  238. // fail: (err) => {
  239. // console.log('err', err);
  240. // }
  241. // });
  242. // },
  243. // fail: function (res) {
  244. // console.log(res.errMsg);
  245. // }
  246. // });
  247. // }
  248. // },
  249. // #ifdef MP-WEIXIN
  250. toJSON () { return this },
  251. // #endif
  252. /**
  253. * @description 播放视频事件
  254. * @param {Event} e
  255. */
  256. play (e) {
  257. this.root.$emit('play')
  258. // #ifndef APP-PLUS
  259. if (this.root.pauseVideo) {
  260. let flag = false
  261. const id = e.target.id
  262. for (let i = this.root._videos.length; i--;) {
  263. if (this.root._videos[i].id === id) {
  264. flag = true
  265. } else {
  266. this.root._videos[i].pause() // 自动暂停其他视频
  267. }
  268. }
  269. // 将自己加入列表
  270. if (!flag) {
  271. const ctx = uni.createVideoContext(id
  272. // #ifndef MP-BAIDU
  273. , this
  274. // #endif
  275. )
  276. ctx.id = id
  277. if (this.root.playbackRate) {
  278. ctx.playbackRate(this.root.playbackRate)
  279. }
  280. this.root._videos.push(ctx)
  281. }
  282. }
  283. // #endif
  284. },
  285. /**
  286. * @description 图片点击事件
  287. * @param {Event} e
  288. */
  289. imgTap (e) {
  290. const node = this.childs[e.currentTarget.dataset.i]
  291. if (node.a) {
  292. this.linkTap(node.a)
  293. return
  294. }
  295. if (node.attrs.ignore) return
  296. // #ifdef H5 || APP-PLUS
  297. node.attrs.src = node.attrs.src || node.attrs['data-src']
  298. // #endif
  299. this.root.$emit('imgtap', node.attrs)
  300. // 自动预览图片
  301. if (this.root.previewImg) {
  302. uni.previewImage({
  303. // #ifdef MP-WEIXIN
  304. showmenu: this.root.showImgMenu,
  305. // #endif
  306. // #ifdef MP-ALIPAY
  307. enablesavephoto: this.root.showImgMenu,
  308. enableShowPhotoDownload: this.root.showImgMenu,
  309. // #endif
  310. current: parseInt(node.attrs.i),
  311. urls: this.root.imgList
  312. })
  313. }
  314. },
  315. /**
  316. * @description 图片长按
  317. */
  318. imgLongTap (e) {
  319. // #ifdef APP-PLUS
  320. const attrs = this.childs[e.currentTarget.dataset.i].attrs
  321. if (this.opts[3] && !attrs.ignore) {
  322. uni.showActionSheet({
  323. itemList: ['保存图片'],
  324. success: () => {
  325. const save = path => {
  326. uni.saveImageToPhotosAlbum({
  327. filePath: path,
  328. success () {
  329. uni.showToast({
  330. title: '保存成功'
  331. })
  332. }
  333. })
  334. }
  335. if (this.root.imgList[attrs.i].startsWith('http')) {
  336. uni.downloadFile({
  337. url: this.root.imgList[attrs.i],
  338. success: res => save(res.tempFilePath)
  339. })
  340. } else {
  341. save(this.root.imgList[attrs.i])
  342. }
  343. }
  344. })
  345. }
  346. // #endif
  347. },
  348. /**
  349. * @description 图片加载完成事件
  350. * @param {Event} e
  351. */
  352. imgLoad (e) {
  353. const i = e.currentTarget.dataset.i
  354. /* #ifndef H5 || (APP-PLUS && VUE2) */
  355. if (!this.childs[i].w) {
  356. // 设置原宽度
  357. this.$set(this.ctrl, i, e.detail.width)
  358. } else /* #endif */ if ((this.opts[1] && !this.ctrl[i]) || this.ctrl[i] === -1) {
  359. // 加载完毕,取消加载中占位图
  360. this.$set(this.ctrl, i, 1)
  361. }
  362. this.checkReady()
  363. },
  364. /**
  365. * @description 检查是否所有图片加载完毕
  366. */
  367. checkReady () {
  368. if (this.root && !this.root.lazyLoad) {
  369. this.root._unloadimgs -= 1
  370. if (!this.root._unloadimgs) {
  371. setTimeout(() => {
  372. this.root.getRect().then(rect => {
  373. this.root.$emit('ready', rect)
  374. }).catch(() => {
  375. this.root.$emit('ready', {})
  376. })
  377. }, 350)
  378. }
  379. }
  380. },
  381. /**
  382. * @description 链接点击事件
  383. * @param {Event} e
  384. */
  385. linkTap (e) {
  386. const node = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {}
  387. const attrs = node.attrs || e
  388. const href = attrs.href
  389. if (attrs['data-value']) {
  390. this.root.$emit('linktap1', attrs);
  391. return
  392. }
  393. this.root.$emit('linktap', Object.assign({
  394. innerText: this.root.getText(node.children || []) // 链接内的文本内容
  395. }, attrs))
  396. if (href) {
  397. if (href[0] === '#') {
  398. // 跳转锚点
  399. this.root.navigateTo(href.substring(1)).catch(() => { })
  400. } else if (href.split('?')[0].includes('://')) {
  401. // 复制外部链接
  402. if (this.root.copyLink) {
  403. // #ifdef H5
  404. window.open(href)
  405. // #endif
  406. // #ifdef MP
  407. uni.setClipboardData({
  408. data: href,
  409. success: () =>
  410. uni.showToast({
  411. title: '链接已复制'
  412. })
  413. })
  414. // #endif
  415. // #ifdef APP-PLUS
  416. plus.runtime.openWeb(href)
  417. // #endif
  418. }
  419. } else {
  420. // 跳转页面
  421. uni.navigateTo({
  422. url: href,
  423. fail () {
  424. uni.switchTab({
  425. url: href,
  426. fail () { }
  427. })
  428. }
  429. })
  430. }
  431. }
  432. },
  433. /**
  434. * @description 错误事件
  435. * @param {Event} e
  436. */
  437. mediaError (e) {
  438. const i = e.currentTarget.dataset.i
  439. const node = this.childs[i]
  440. // 加载其他源
  441. if (node.name === 'video' || node.name === 'audio') {
  442. let index = (this.ctrl[i] || 0) + 1
  443. if (index > node.src.length) {
  444. index = 0
  445. }
  446. if (index < node.src.length) {
  447. this.$set(this.ctrl, i, index)
  448. return
  449. }
  450. } else if (node.name === 'img') {
  451. // #ifdef H5 && VUE3
  452. if (this.opts[0] && !this.ctrl.load) return
  453. // #endif
  454. // 显示错误占位图
  455. if (this.opts[2]) {
  456. this.$set(this.ctrl, i, -1)
  457. }
  458. this.checkReady()
  459. }
  460. if (this.root) {
  461. this.root.$emit('error', {
  462. source: node.name,
  463. attrs: node.attrs,
  464. // #ifndef H5 && VUE3
  465. errMsg: e.detail.errMsg
  466. // #endif
  467. })
  468. }
  469. }
  470. }
  471. }
  472. </script>
  473. <style>
  474. /deep/ .hl-code,
  475. /deep/ .hl-pre {
  476. color: #ccc;
  477. background: 0 0;
  478. font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  479. font-size: 1em;
  480. text-align: left;
  481. white-space: pre;
  482. word-spacing: normal;
  483. word-break: normal;
  484. word-wrap: normal;
  485. line-height: 1.5;
  486. -moz-tab-size: 4;
  487. -o-tab-size: 4;
  488. tab-size: 4;
  489. -webkit-hyphens: none;
  490. -moz-hyphens: none;
  491. -ms-hyphens: none;
  492. hyphens: none
  493. }
  494. /deep/ .hl-pre {
  495. padding: 1em;
  496. margin: .5em 0;
  497. overflow: auto
  498. }
  499. /deep/ .hl-pre {
  500. background: #2d2d2d
  501. }
  502. /deep/ .hl-block-comment,
  503. /deep/ .hl-cdata,
  504. /deep/ .hl-comment,
  505. /deep/ .hl-doctype,
  506. /deep/ .hl-prolog {
  507. color: #999
  508. }
  509. /deep/ .hl-punctuation {
  510. color: #ccc
  511. }
  512. /deep/ .hl-attr-name,
  513. /deep/ .hl-deleted,
  514. /deep/ .hl-namespace,
  515. /deep/ .hl-tag {
  516. color: #e2777a
  517. }
  518. /deep/ .hl-function-name {
  519. color: #6196cc
  520. }
  521. /deep/ .hl-boolean,
  522. /deep/ .hl-function,
  523. /deep/ .hl-number {
  524. color: #f08d49
  525. }
  526. /deep/ .hl-class-name,
  527. /deep/ .hl-constant,
  528. /deep/ .hl-property,
  529. /deep/ .hl-symbol {
  530. color: #f8c555
  531. }
  532. /deep/ .hl-atrule,
  533. /deep/ .hl-builtin,
  534. /deep/ .hl-important,
  535. /deep/ .hl-keyword,
  536. /deep/ .hl-selector {
  537. color: #cc99cd
  538. }
  539. /deep/ .hl-attr-value,
  540. /deep/ .hl-char,
  541. /deep/ .hl-regex,
  542. /deep/ .hl-string,
  543. /deep/ .hl-variable {
  544. color: #7ec699
  545. }
  546. /deep/ .hl-entity,
  547. /deep/ .hl-operator,
  548. /deep/ .hl-url {
  549. color: #67cdcc
  550. }
  551. /deep/ .hl-bold,
  552. /deep/ .hl-important {
  553. font-weight: 700
  554. }
  555. /deep/ .hl-italic {
  556. font-style: italic
  557. }
  558. /deep/ .hl-entity {
  559. cursor: help
  560. }
  561. /deep/ .hl-inserted {
  562. color: green
  563. }
  564. /deep/ .md-p {
  565. margin-block-start: 1em;
  566. margin-block-end: 1em;
  567. }
  568. /deep/.hl-copy {
  569. color: #cccccc;
  570. }
  571. /deep/ .md-table,
  572. /deep/ .md-blockquote {
  573. margin-bottom: 16px;
  574. }
  575. /deep/ .md-table {
  576. box-sizing: border-box;
  577. width: 100%;
  578. overflow: auto;
  579. border-spacing: 0;
  580. border-collapse: collapse;
  581. }
  582. /deep/ .md-tr {
  583. background-color: #fff;
  584. border-top: 1px solid #c6cbd1;
  585. }
  586. .md-table .md-tr:nth-child(2n) {
  587. background-color: #f6f8fa;
  588. }
  589. /deep/ .md-th,
  590. /deep/ .md-td {
  591. padding: 6px 13px !important;
  592. border: 1px solid #dfe2e5;
  593. }
  594. /deep/ .md-th {
  595. font-weight: 600;
  596. }
  597. /deep/ .md-blockquote {
  598. padding: 0 1em;
  599. color: #6a737d;
  600. border-left: 0.25em solid #dfe2e5;
  601. }
  602. /deep/ .md-code {
  603. padding: 0.2em 0.4em;
  604. font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
  605. font-size: 85%;
  606. background-color: rgba(27, 31, 35, 0.05);
  607. border-radius: 3px;
  608. }
  609. /deep/ .md-pre .md-code {
  610. padding: 0;
  611. font-size: 100%;
  612. background: transparent;
  613. border: 0;
  614. }
  615. /* a 标签默认效果 */
  616. ._a {
  617. padding: 1.5px 0 1.5px 0;
  618. color: #366092;
  619. word-break: break-all;
  620. }
  621. ._ab {
  622. padding: 5px 7px;
  623. color: #366092;
  624. word-break: break-all;
  625. background-color: #f1f8ff;
  626. border: 1px solid #8bb8f3;
  627. display: inline-block !important;
  628. margin-top: 5px !important;
  629. margin-right: 5px !important;
  630. box-sizing: content-box !important;
  631. }
  632. /* a 标签点击态效果 */
  633. ._hover {
  634. text-decoration: underline;
  635. opacity: 0.7;
  636. }
  637. /* 图片默认效果 */
  638. ._img {
  639. max-width: 100%;
  640. -webkit-touch-callout: none;
  641. }
  642. /* 内部样式 */
  643. ._block {
  644. display: block;
  645. }
  646. ._b,
  647. ._strong {
  648. font-weight: bold;
  649. }
  650. ._code {
  651. font-family: monospace;
  652. }
  653. ._del {
  654. text-decoration: line-through;
  655. }
  656. ._em,
  657. ._i {
  658. font-style: italic;
  659. }
  660. ._h1 {
  661. font-size: 2em;
  662. }
  663. ._h2 {
  664. font-size: 1.5em;
  665. }
  666. ._h3 {
  667. font-size: 1.17em;
  668. }
  669. ._h5 {
  670. font-size: 0.83em;
  671. }
  672. ._h6 {
  673. font-size: 0.67em;
  674. }
  675. ._h1,
  676. ._h2,
  677. ._h3,
  678. ._h4,
  679. ._h5,
  680. ._h6 {
  681. display: block;
  682. font-weight: bold;
  683. }
  684. ._image {
  685. height: 1px;
  686. }
  687. ._ins {
  688. text-decoration: underline;
  689. }
  690. ._li {
  691. display: list-item;
  692. }
  693. ._ol {
  694. list-style-type: decimal;
  695. }
  696. ._ol,
  697. ._ul {
  698. display: block;
  699. padding-left: 40px;
  700. margin: 1em 0;
  701. }
  702. ._q::before {
  703. content: '"';
  704. }
  705. ._q::after {
  706. content: '"';
  707. }
  708. ._sub {
  709. font-size: smaller;
  710. vertical-align: sub;
  711. }
  712. ._sup {
  713. font-size: smaller;
  714. vertical-align: super;
  715. }
  716. ._thead,
  717. ._tbody,
  718. ._tfoot {
  719. display: table-row-group;
  720. }
  721. ._tr {
  722. display: table-row;
  723. }
  724. ._td,
  725. ._th {
  726. display: table-cell;
  727. vertical-align: middle;
  728. }
  729. ._th {
  730. font-weight: bold;
  731. text-align: center;
  732. }
  733. ._ul {
  734. list-style-type: disc;
  735. }
  736. ._ul ._ul {
  737. margin: 0;
  738. list-style-type: circle;
  739. }
  740. ._ul ._ul ._ul {
  741. list-style-type: square;
  742. }
  743. ._abbr,
  744. ._b,
  745. ._code,
  746. ._del,
  747. ._em,
  748. ._i,
  749. ._ins,
  750. ._label,
  751. ._q,
  752. ._span,
  753. ._strong,
  754. ._sub,
  755. ._sup {
  756. display: inline;
  757. }
  758. /* #ifdef APP-PLUS */
  759. ._video {
  760. width: 300px;
  761. height: 225px;
  762. }
  763. /* #endif */
  764. </style>