1.参考git:https://github.com/F-loat/mpvue-wxParse
2.安装
npm i mpvue-wxparse
3.使用
<template> <div> <wxParse :content="article" @preview="preview" @navigate="navigate" /> </div> </template> <script> import wxParse from 'mpvue-wxparse' export default { components: { wxParse }, data () { return { article: '<div>我是HTML代码</div>' } }, methods: { preview(src, e) { // do something }, navigate(href, e) { // do something } } } </script> <style> @import url("~mpvue-wxparse/src/wxParse.css"); </style>