z-index 不生效 coverview 也不生效
coverview无法覆盖canvas?[代码]return[代码] [代码]([代码][代码] [代码][代码]<View className=[代码][代码]"panel"[代码][代码]>[代码][代码] [代码][代码]<View className=[代码][代码]"panel-background"[代码][代码]>[代码][代码] [代码][代码]<Canvas[代码][代码] [代码][代码]type=[代码][代码]"2d"[代码][代码] [代码][代码]className=[代码][代码]"panel-background-canvas[代码][代码]"[代码][代码] [代码][代码]style=[代码][代码]"z-index:-10"[代码][代码] [代码][代码]ref={(node) => { [代码][代码]this[代码][代码].canvasNode = node }}[代码][代码] [代码][代码]id=[代码][代码]"myCanvas"[代码][代码] [代码][代码]>[代码][代码] [代码][代码]<CoverView className=[代码][代码]"panel-background-gray"[代码] [代码]ref={canvasRef}>[代码][代码] [代码][代码]</CoverView>[代码][代码] [代码][代码]</Canvas>[代码][代码] [代码] [代码] [代码][代码]</View>[代码][代码] [代码][代码]</View>[代码][代码])[代码] [代码][代码] [代码].panel {[代码][代码] [代码][代码]width[代码][代码]: [代码][代码]520px[代码][代码];[代码][代码] [代码][代码]height[代码][代码]: [代码][代码]520px[代码][代码];[代码][代码] [代码][代码]margin[代码][代码]: [代码][代码]0[代码] [代码]auto[代码][代码];[代码][代码] [代码][代码]margin-top[代码][代码]: [代码][代码]40px[代码][代码];[代码][代码] [代码][代码]position[代码][代码]: [代码][代码]relative[代码][代码];[代码][代码] [代码] [代码] [代码][代码]&-background {[代码][代码] [代码][代码]height[代码][代码]: [代码][代码]100%[代码][代码];[代码][代码] [代码][代码]position[代码][代码]: [代码][代码]relative[代码][代码];[代码][代码] [代码][代码]background-[代码][代码]size[代码][代码]: [代码][代码]100%[代码] [代码]100%[代码][代码];[代码][代码] [代码][代码]&-canvas{[代码][代码] [代码][代码]top[代码][代码]: [代码][代码]0[代码][代码];[代码][代码] [代码][代码]left[代码][代码]: [代码][代码]0[代码][代码];[代码][代码] [代码][代码]position[代码][代码]: [代码][代码]absolute[代码][代码];[代码][代码] [代码][代码]display[代码][代码]: [代码][代码]block[代码] [代码]!important[代码][代码];[代码][代码] [代码][代码]width[代码][代码]: [代码][代码]480px[代码][代码];[代码][代码] [代码][代码]height[代码][代码]: [代码][代码]480px[代码][代码];[代码][代码] [代码][代码]z-index[代码][代码]: [代码][代码]-1[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]&-[代码][代码]gray[代码] [代码]{[代码][代码] [代码][代码]top[代码][代码]: [代码][代码]0[代码][代码];[代码][代码] [代码][代码]left[代码][代码]: [代码][代码]0[代码][代码];[代码][代码] [代码][代码]position[代码][代码]: [代码][代码]absolute[代码][代码];[代码][代码] [代码][代码]margin[代码][代码]: [代码][代码]20px[代码][代码];[代码][代码] [代码][代码]width[代码][代码]: [代码][代码]480px[代码][代码];[代码][代码] [代码][代码]height[代码][代码]: [代码][代码]480px[代码][代码];[代码][代码] [代码][代码]z-index[代码][代码]: [代码][代码]1[代码][代码];[代码][代码] [代码][代码]border-radius: [代码][代码]50%[代码][代码];[代码][代码] [代码][代码]background[代码][代码]: [代码][代码]blue[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码]}[代码]"libVersion": "2.9.3", 如上结构 在开发工具上显示如下 [图片] 效果如图 红色为canvas绘制 蓝色是CoverView 的背景 [图片]
2019-12-12请问这个问题解决了嘛?我也遇到了这个问题 使用 [代码]<View className=[代码][代码]"panel"[代码][代码]>[代码][代码] [代码][代码]<View className=[代码][代码]"panel-background"[代码][代码]>[代码][代码] [代码][代码]<Canvas[代码][代码] [代码][代码]type=[代码][代码]"2d"[代码][代码] [代码][代码]className=[代码][代码]"canvas"[代码][代码] [代码][代码]style=[代码][代码]"z-index:-10"[代码][代码] [代码][代码]ref={(node) => { [代码][代码]this[代码][代码].canvasNode = node }}[代码][代码] [代码][代码]id=[代码][代码]"myCanvas"[代码][代码] [代码][代码]>[代码][代码] [代码][代码]<CoverView className=[代码][代码]"panel-background-gray"[代码] [代码]ref={canvasRef}>[代码][代码] [代码][代码]<CoverImage className=[代码][代码]"panel-background-img"[代码] [代码]src={PanelImg} alt=[代码][代码]""[代码] [代码]/>[代码][代码] [代码][代码]<CoverView className={cs({ [代码][代码]'panel-loading'[代码][代码]: [代码][代码]true[代码][代码], [代码][代码]'ani-rotate'[代码][代码]: loading })} />[代码][代码] [代码][代码]</CoverView>[代码][代码] [代码][代码]</Canvas>[代码][代码] [代码] [代码] [代码][代码]</View>[代码][代码] [代码][代码]</View>[代码]canvas 还是会覆盖coverView和coverimage
借问各位大神, 小弟在用canvas绘图之后,出现图像层级不正确的问题?如下图所示, 覆盖在上层的是canvas绘制出来的图像,下层是一个compenent,做的类似弹出效果。但是被canvas覆盖了。在电脑端没有这个问题。 [图片]
2019-12-12