- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
<view class="tab">
<view class="tab_item {{index==0?'active':''}}" data-id="0" catchtap="click">1</view>
<view class="tab_item {{index==1?'active':''}}" data-id="1" catchtap="click">2</view>
<view class="tab_item {{index==2?'active':''}}" data-id="2" catchtap="click">3</view>
</view>
<view wx:if="{{index==0}}">
<editor id="editor{{index}}" class="ql-container" placeholder="{{placeholder}}" showImgSize showImgToolbar showImgResize bindstatuschange="onStatusChange" bindinput="shuru" read-only="{{readOnly}}" bindready="onEditorReady">
</editor>
</view>
<view wx:if="{{index==1}}">
<editor id="editor{{index}}" class="ql-container" placeholder="{{placeholder}}" showImgSize showImgToolbar showImgResize bindstatuschange="onStatusChange" bindinput="shuru" read-only="{{readOnly}}" bindready="onEditorReady">
</editor>
</view>
<view wx:if="{{index==2}}">
<editor id="editor{{index}}" class="ql-container" placeholder="{{placeholder}}" showImgSize showImgToolbar showImgResize bindstatuschange="onStatusChange" bindinput="shuru" read-only="{{readOnly}}" bindready="onEditorReady">
</editor>
</view>
onEditorReady(index) {
index = 0||index;
console.log("3333333333333333333333333", index)
const that = this
wx.createSelectorQuery().select(`#editor${index}`).context(function (res) {
that.editorCtx = res.context;
that.editorCtx.setContents({
html: that.data.Details,
success:function(res){
console.log("渲染成功")
},
fail:function(err){
console.log("渲染失败")
}
})
}).exec()
},
click:function(e){
var _this =this , id = e.currentTarget.dataset.id;
console.log("ididididididid",id)
_this.setData({
index:id
})
_this.onEditorReady(id)
}
渲染正常,不知道为什么报错
麻烦提供一下这种格式的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
是这个判断条件的问题哦,看你需求应该是默认为0,但这个默认也是取不到0 的