提交 f9d5af3c 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

补充测试例

上级 2a6d70d4
......@@ -61,7 +61,7 @@
let ctx = element.getDrawableContext()!
let width = element.getBoundingClientRect().width
ctx.reset()
ctx.font = "15px"
ctx.font = "15px Arial"
ctx.textAlign = "center"
for (var i = 0; i < this.texts.length; i++) {
let value = this.texts[i]
......
......@@ -3,6 +3,8 @@
<scroll-view style="flex:1">
<!-- #endif -->
<view>
// iOS平台宽高为0时,设置渐变色会不会导致闪退
<view style="width: 0px; height: 0px; background-image: linear-gradient(to bottom,#f5f5f5,#eff2f5);"></view>
<text>不支持背景图片,仅支持linear-gradient方法</text>
<view v-for="(direction) in directionData">
<text>background-image: linear-gradient({{direction}}, red, yellow)</text>
......
......@@ -21,6 +21,12 @@
<text class="text">点击修改Background</text>
<view class="base-style transition-background" id="styleBackground" @click="changeBackground"></view>
</view>
<view class="container">
<text class="text">点击修改Background(颜色带透明度)</text>
<view style="flex: 1;">
<view class="base-style transition-background" id="styleBackground2" @click="changeBackground2"></view>
</view>
</view>
<view class="container">
<text class="text">动态修改Background</text>
<view class="base-style" id="propertyStyleBackground" @click="propertyChangeBackground"></view>
......@@ -63,6 +69,7 @@
stylePadding: null as UniElement | null,
isTransitionstyleBackground: false,
styleBackground: null as UniElement | null,
styleBackground2: null as UniElement | null,
isTransitionStyleTransform: false,
styleTransform: null as UniElement | null,
isTransitionStyleTransformWithWidth:false,
......@@ -83,6 +90,7 @@
this.styleMargin = uni.getElementById("styleMargin")
this.stylePadding = uni.getElementById("stylePadding")
this.styleBackground = uni.getElementById("styleBackground")
this.styleBackground2 = uni.getElementById("styleBackground2")
this.styleTransform = uni.getElementById("styleTransform")
this.styleBorder = uni.getElementById("styleBorder")
this.stylePosition = uni.getElementById("stylePosition")
......@@ -129,6 +137,14 @@
)
this.isTransitionstyleBackground = !this.isTransitionstyleBackground
},
changeBackground2() {
console.log(aa)
this.styleBackground2?.style?.setProperty("background-color", this.isTransitionstyleBackground
? 'brown'
: 'rgba(0, 0, 0, 0.5);'
)
this.isTransitionstyleBackground = !this.isTransitionstyleBackground
},
propertyChangeBackground() {
if (!this.isSetTransition) {
this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color")
......@@ -201,6 +217,11 @@
background-color: brown;
}
.transform-bgColor {
transition-property: background-color;
transition-duration: 0.5s;
}
.transition-width {
transition-property: width;
transition-duration: 1s;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册