module.exports = { chainWebpack: config => { config.module .rule('md') .test(/\.md$/) .use('html-loader') .loader('html-loader') .end() .use('markdown-loader') .loader('markdown-loader') .end() } }
This configuration is vue.config.js
You need to install dependencies:
cnpm i html-loader markdown-loader --save-dev
File using
<Template> <div> <div V =-HTML "MD"> </ div> </ div> </ Template> <Script> Import Demo from "../../assets/demo.md"; Console. log (Demo) Export default { Data () { return { MD: Demo }; } }; </ Script> <style lang = "less" scoped> // constraint here markdown label style parsed out, as provided h3 } ... { </ style>
If not specified, the console.log md loader, incorporated demo.md () is an output template vue analysis target (target vue-loader after processing). Html is arranged after the output of the string parsing md