Article From:https://www.cnblogs.com/Webzhoushifa/p/9557099.html

There is not much to say.

First, NPM install mpvue-wxparse.

npm i mpvue-wxparse

Next: use

<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>I am the HTML code < /div>'
    }
  },
  methods: {
    preview(src, e) {
      // do something
    },
    navigate(href, e) {
      // do something
    }
  }
}
</script>

<style>
@import url("~mpvue-wxparse/src/wxParse.css");
</style>

Of course: we can dynamically load values in article.

Extended learning address: https://github.com/htzhanglong/mpvue-wxParse

Leave a Reply

Your email address will not be published. Required fields are marked *