乱码乱a∨中文字幕,在线免费激情视频,亚洲欧美久久夜夜潮,国产在线网址

  1. <sub id="hjl7n"></sub>

    1. <sub id="hjl7n"></sub>

      <legend id="hjl7n"></legend>

      當(dāng)前位置:首頁(yè) >  站長(zhǎng) >  編程技術(shù) >  正文

      nuxt+vue項(xiàng)目中要實(shí)現(xiàn)展示markdown文件

       2020-11-05 14:23  來(lái)源: 田珊珊個(gè)人博客   我來(lái)投稿 撤稿糾錯(cuò)

        阿里云優(yōu)惠券 先領(lǐng)券再下單

      1、安裝依賴

      npm i markdown-loader html-loader --save

      npm i showdown --save

      2、配置nuxt.config.js文件

      build: {

      transpile: [/^element-ui/],

      /*

      ** You can extend webpack config here

      */

      extend (config, { isDev, isClient }) {

      config.module.rules.push({

      test: /\.md$/,

      use: [

      {loader: 'html-loader'},

      {loader: 'markdown-loader', options: {}}

      ],

      })

      }

      },

      3、markdown文件引入并轉(zhuǎn)換

      import readme from '~/static/api.md';

      Vue.prototype.md2html = (md)=> {

      let converter = new showdown.Converter()

      let text = md.toString()

      let html = converter.makeHtml(text)

      return html

      }

      調(diào)用:this.md2html(readme);

      本博主想把代碼全部拷過(guò)來(lái),但是又覺(jué)得那樣別人會(huì)直接不懂腦筋的抄襲,所以最后一步留了一點(diǎn)點(diǎn),只要稍微用心一下就能看懂的哦。

      文章來(lái)源:田珊珊個(gè)人博客

      來(lái)源地址:http://www.tianshan277.com/836.html

      申請(qǐng)創(chuàng)業(yè)報(bào)道,分享創(chuàng)業(yè)好點(diǎn)子。點(diǎn)擊此處,共同探討創(chuàng)業(yè)新機(jī)遇!

      相關(guān)文章

      熱門(mén)排行

      信息推薦