🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

mini-program-parser

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-program-parser - npm Package Compare versions

Comparing version
0.3.3
to
0.3.4
+32
component/mini-parser/table-render/index.js
Component({
options: {
addGlobalClass: true, // page样式影响组件内样式
},
properties: {
tableData: { type: [Array] },
},
data: {
parserData: null,
},
observers: {
tableData(data) {
if (!data) return;
const { children } = data;
if (!children) return;
const parserData = data;
const wrapper = children.filter((item) =>
["thead", "tbody"].includes(item.name)
);
if (wrapper) {
parserData.children = [];
wrapper.forEach((item) => {
parserData.children = [...parserData.children, ...item.children];
});
}
console.log(parserData);
this.setData({
parserData,
});
},
},
});
{
"component": true,
"usingComponents": {
"render": "../render/index"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

+2
-18

@@ -0,1 +1,3 @@

import { MiniParser } from "mini-program-parser";
Component({

@@ -26,20 +28,2 @@ options: {

parsedData(data) {
if (!data) return;
// 特殊处理表格标签
if (data.length > 0) {
data.forEach((dataItem) => {
const { name, children } = dataItem;
if (name === "table" && children) {
const wrapper = children.filter((item) =>
["thead", "tbody"].includes(item.name)
);
if (wrapper) {
dataItem.children = [];
wrapper.forEach((item) => {
dataItem.children = [...dataItem.children, ...item.children];
});
}
}
});
}
this.setData({

@@ -46,0 +30,0 @@ parserData: data,

{
"component": true,
"usingComponents": {
"render": "./index"
"render": "./index",
"tableRender": "../table-render/index"
}
}
{
"name": "mini-program-parser",
"version": "0.3.3",
"version": "0.3.4",
"scripts": {

@@ -5,0 +5,0 @@ "dev": "rollup -c ./rollup.dev.config.js --watch",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet