app.js
App({
// 引入`towxml3.0`解析方法
towxml:require('/towxml/index'),
onLaunch() {
}
})
index.wxml
<view class="answer-questions">
<towxml nodes="{{content}}" />
</view>
index.js
const app = getApp()
Page({
data: {
content:""
},
onLoad() {
let result = app.towxml("$C:{\rm{y}}^2 = 2px(p > 0)$", 'markdown', {
base: 'https://xxx.com', // 相对资源的base路径
theme: 'light', // 主题,默认`light`
events: { // 为元素绑定的事件方法
tap: (e) => {
console.log('tap', e);
}
}
});
// 更新解析数据
this.setData({
content: result,
});
},
})
index.json
{
"usingComponents": {
"towxml":"../towxml/towxml"
}
}
然后真机调试就报错了
请问解决了吗?我现在也这样
没用过,但是看报错是缺少依赖,再看看对应的文档吧