< canvas canvas-id = "canvas" id = "canvas" >
< cover-view id = 'mask' wx:if = '{{show}}' ></ cover-view >
</ canvas >
< button bindtap = "change" >按钮</ button >
|
#mask{
position : absolute ;
top : 0 ;
left : 0 ;
width : 100px ;
height : 100px ;
background : #333 ;
}
|
onLoad: function (options) {
let ctx=wx.createCanvasContext( 'canvas' )
ctx.setFillStyle( 'red' )
ctx.fillRect(0,0,300,150)
ctx.draw()
},
change(){
this .setData({
show:! this .data.show
})
},
|
上面是简单的代码,在我点击按钮的时候就会显示隐藏那个cover-view标签,问题是我每点击一次都会增加一个<
cover-view
id
=
‘mask’
wx:if
=
’{{show}}’
></
cover-view
>这样的标签最后就会跟下图一样,请问这个是官方的bug么?