根据真机报错,推断ios端对props中类型为function的数据处理有错误。
可看出,报错信息说,接受的类型有错。
本人解决方式:
将u-parse.vue文件中computed中的nodes中代码修改。
nodes() {
const {
content,
noData,
imageProp,
startHandler,
endHandler,
charsHandler,
} = this;
const parseData = content || noData;
const customHandler = {
start: startHandler,
end: endHandler,
chars: charsHandler,
};
const results = HtmlToJson(parseData, customHandler, imageProp, this);
this.imageUrls = results.imageUrls;
console.log(results);
return results.nodes;
},
改为=>
nodes() {
const {
content,
noData,
imageProp,
startHandler,
endHandler,
charsHandler,
} = this;
const parseData = content || noData;
const customHandler = {
start: (typeof startHandler === "function") ? startHandler: (node) => {
node.attr.class = null;
node.attr.style = null;
},
end: endHandler,
chars: charsHandler,
};
const results = HtmlToJson(parseData, customHandler, imageProp, this);
this.imageUrls = results.imageUrls;
console.log(results);
return results.nodes;
},
说白了就是他既然要函数就给他个函数。
本人解决方式不一定是最优解决方式。