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

遴选dev之前提交的 commit

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