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

增加 transition width 测试例

上级 2287d51d
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<text class="text">点击修改宽度</text> <text class="text">点击修改宽度</text>
<view class="base-style transition-width" id="widthOrHeight" @click="changeWidthOrHeight"></view> <view class="base-style transition-width" id="widthOrHeight" @click="changeWidthOrHeight"></view>
</view> </view>
<view class="container">
<text class="text">点击修改宽度(递增)</text>
<view class="width-progress transition-width" id="widthProgress" @click="changeWidthProgress"></view>
</view>
<view class="container"> <view class="container">
<text class="text">点击修改Margin</text> <text class="text">点击修改Margin</text>
<view class="base-style transition-margin" id="styleMargin" @click="changeMargin"></view> <view class="base-style transition-margin" id="styleMargin" @click="changeMargin"></view>
...@@ -57,6 +61,8 @@ ...@@ -57,6 +61,8 @@
return { return {
isTranstionWidthOrHeight: false, isTranstionWidthOrHeight: false,
widthOrHeight: null as UniElement | null, widthOrHeight: null as UniElement | null,
widthProgress: null as UniElement | null,
progressWidth: 200,
isTranstionChangeMargin: false, isTranstionChangeMargin: false,
styleMargin: null as UniElement | null, styleMargin: null as UniElement | null,
isTransitionStylePadding: false, isTransitionStylePadding: false,
...@@ -80,6 +86,7 @@ ...@@ -80,6 +86,7 @@
}, },
onReady() { onReady() {
this.widthOrHeight = uni.getElementById("widthOrHeight") this.widthOrHeight = uni.getElementById("widthOrHeight")
this.widthProgress = uni.getElementById("widthProgress")
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")
...@@ -97,6 +104,10 @@ ...@@ -97,6 +104,10 @@
: '300px') : '300px')
this.isTranstionWidthOrHeight = !this.isTranstionWidthOrHeight this.isTranstionWidthOrHeight = !this.isTranstionWidthOrHeight
}, },
changeWidthProgress() {
this.progressWidth += 20
this.widthProgress?.style?.setProperty("width", this.progressWidth + 'px')
},
changeMargin() { changeMargin() {
this.styleMargin?.style?.setProperty("margin-top", this.isTranstionChangeMargin this.styleMargin?.style?.setProperty("margin-top", this.isTranstionChangeMargin
? '0px' ? '0px'
...@@ -201,6 +212,17 @@ ...@@ -201,6 +212,17 @@
background-color: brown; background-color: brown;
} }
.width-progress {
width: 200px;
height: 200px;
background-color: brown;
}
.transform-bgColor {
transition-property: background-color;
transition-duration: 0.5s;
}
.transition-width { .transition-width {
transition-property: width; transition-property: width;
transition-duration: 1s; transition-duration: 1s;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册