小程序video和live-player 覆盖样式

程序的video和live-player 不会被view标签覆盖,即使用了z-index也不行。
官方有说明。
cover-view
覆盖在原生组件之上的文本视图。

可覆盖的原生组件包括 map、video、canvas、camera、live-player、live-pusher

只支持嵌套 cover-view、cover-image,可在 cover-view 中使用 button。组件属性的长度单位默认为px,2.4.0起支持传入单位(rpx/px)。
在这里插入图片描述
Bug & Tip
tip: cover-view和cover-image的aria-role仅可设置为button,读屏模式下才可以点击,并朗读出“按钮”;为空时可以聚焦,但不可点击
tip: 基础库 2.2.4 起支持 touch 相关事件,也可使用 hover-class 设置点击态
tip: 基础库 2.1.0 起支持设置 scale rotate 的 css 样式,包括 transition 动画
tip: 基础库 1.9.90 起 cover-view 支持 overflow: scroll,但不支持动态更新 overflow
tip: 基础库 1.9.90 起最外层 cover-view 支持 position: fixed
tip: 基础库 1.9.0 起支持插在 view 等标签下。在此之前只可嵌套在原生组件map、video、canvas、camera内,避免嵌套在其他组件内。
tip: 基础库 1.6.0 起支持css transition动画,transition-property只支持transform (translateX, translateY)与opacity。
tip: 基础库 1.6.0 起支持css opacity。
tip: 事件模型遵循冒泡模型,但不会冒泡到原生组件。
tip: 文本建议都套上cover-view标签,避免排版错误。
tip: 只支持基本的定位、布局、文本样式。不支持设置单边的border、background-image、shadow、overflow: visible等。
tip: 建议子节点不要溢出父节点
tip: 支持使用 z-index 控制层级
tip: 默认设置的样式有:white-space: nowrap; line-height: 1.2; display: block;
bug: 自定义组件嵌套 cover-view 时,自定义组件的 slot 及其父节点暂不支持通过 wx:if 控制显隐,否则会导致 cover-view 不显示

<video>
	<cover-view></cover-view>
</video>

cover-view不会自动根据内容撑开,因为他固定的样式是超出隐藏,单行展示。
要将overflow:hidden;去掉 white-space:nowrap 不换行样式去掉;
这里要看好,cover-view是不支持border图片的,也不支持背景颜色渐变。

cover-image
覆盖在原生组件之上的图片视图。可覆盖的原生组件同cover-view,支持嵌套在cover-view里。
在这里插入图片描述

<video>
	<cover-view>
		<cover-image></cover-image>
	</cover-view>
</video>

<live-player>
	<cover-view>
		<cover-image></cover-image>
	</cover-view>
</live-player>

猜你喜欢

转载自blog.csdn.net/j244233138/article/details/90793899