1、修改components\feng-parse\libs\html2json.js
//处理table
if (node.tag === 'table' || node.tag === 'tr' || node.tag === 'td') {
node.styleStr = ""
if (node.attr.width) {
// node.styleStr += "width:" + node.attr.width + 'px;'
node.attr.style.forEach((key) => {
node.styleStr +=' '+key
});
if (node.attr.width > node.$screen.width) {
//等比缩放height
if (node.attr.height) {
node.attr.height = (node.$screen.width * node.attr.height) / node.attr.width
}
}
}
if (node.attr.height) {
node.styleStr += "height:" + node.attr.height + 'px;'
}
}
2、修改components\feng-parse\components\wxParseTable.vue
loadNode(node) {
// console.log(node)
let obj = [];
for (let children of node) {
if (children.node=='element') {
let t = {
name:children.tag,
attrs: {
class: children.classStr,
style: children.styleStr,
},
children: children.nodes?this.loadNode(children.nodes):[]
}
if(children.tag=='td'){
if(children.attr.colspan){
t.attrs['colspan']=children.attr.colspan
}
if(children.attr.rowspan){
t.attrs['rowspan']=children.attr.rowspan
}
}
obj.push(t)
} else if(children.node=='text'){
obj.push({
type: 'text',
text: children.text
})
}
}
return obj
}
修改components\feng-parse\parse.css
.wxParse .p ==》.wxParse>.p