1
0
mirror of https://github.com/sahadev/vue-component-creater-ui.git synced 2025-06-07 21:54:05 +08:00

update: 基础的二次解析能力

This commit is contained in:
shangbin 2021-12-06 20:16:00 +08:00
parent 1cbe8fff43
commit e0a7222dae

View File

@ -1,5 +1,5 @@
//该文件用于解析HTML输出为Object对象
import htmlparser2 from "htmlparser2"
import { Parser } from "htmlparser2"
function getNodeContent(node) {
return node[Object.keys(node)[0]];
@ -35,7 +35,7 @@ function parseHtml(htmlData) {
let lastAccessStack = [root];
// options docment: https://github.com/fb55/htmlparser2/wiki/Parser-options
const parser = new htmlparser2.Parser({
const parser = new Parser({
onopentag(tagname, attributes) {
const newNode = generateNewNode(tagname, attributes);
lastAccessStack.push(newNode);