UNPKG

856 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.htmlParse = htmlParse;
7exports.install = install;
8
9var _html2json = require("./parse/html2json");
10
11/**
12 * utils函数引入
13 **/
14// function agentFunc(){
15// };
16
17/**
18 * 主函数入口区
19 **/
20function htmlParse() {
21 var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '<div></div>';
22 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23 var transData = {}; //存放转化后的数据
24
25 var res = {}; //返回的数据
26
27 transData = (0, _html2json.html2json)(data, 'root', options); // console.log('解析结果是', transData);
28
29 res = transData;
30 return res;
31}
32/**
33 * plugin挂载方法
34 **/
35
36
37function install(Vue) {
38 Vue.prototype.$htmlParse = htmlParse;
39 Vue.prototype.$agentFunc = agentFunc;
40}
\No newline at end of file