Skip to content

borie88/wxparse-richtext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

wxparse-richtext

See sample.js file for details on how to set up:

const Html = require('/parse-rich/html.js');

Page({
	data: {
		item: {}
		nodes: []
	},
	onLoad: function () {
		getItem().then(item => {
			this.prepareBody(item.body)
		})
	},
	prepareBody: function (body) {
    var nodes
    function start (body) {
      return Html.html2json(body, 'main')
    }
    nodes = start(body).children
    if (nodes.length) {
      this.setData({nodes}) // or put this in your post dataset
    }
  },
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published