From 1f6933acc8f09421e0b56dd34bf22356a5672f13 Mon Sep 17 00:00:00 2001 From: XHY Date: Fri, 26 Apr 2024 16:18:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20transition=20transform-tra?= =?UTF-8?q?nslate=20=E9=80=9A=E8=BF=87%=E6=AF=94=E5=81=9A=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 52bac8b79b1fc679357c6cc3e18e39416eb6f927) --- pages/CSS/transition/transition.uvue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pages/CSS/transition/transition.uvue b/pages/CSS/transition/transition.uvue index 2b7b374d..1757a8e9 100644 --- a/pages/CSS/transition/transition.uvue +++ b/pages/CSS/transition/transition.uvue @@ -33,6 +33,10 @@ 点击修改Transform + + 点击修改TransformTranslate + + 点击修改Transform和宽 @@ -82,6 +86,8 @@ propertyStyleBackground: null as UniElement | null, isTransitionStyleTransformWithOrigin: false, styleTransformWithOrigin: null as UniElement | null, + styleTransformTranslate: null as UniElement | null, + isTransformTranslate: false } }, onReady() { @@ -96,6 +102,7 @@ this.propertyStyleBackground = uni.getElementById("propertyStyleBackground") this.styleTransformWithOrigin = uni.getElementById("styleTransformWithOrigin") this.styleTransformWithWidth = uni.getElementById("styleTransformWithWidth") + this.styleTransformTranslate = uni.getElementById("transformTranslate") }, methods: { changeWidthOrHeight() { @@ -159,6 +166,11 @@ ) this.isTransitionStyleTransform = !this.isTransitionStyleTransform }, + changeTransformTranslate() { + const translate = this.isTransformTranslate ? `translate(0%,0%)` : `translate(100%,0%)` + this.styleTransformTranslate?.style?.setProperty('transform', translate) + this.isTransformTranslate = !this.isTransformTranslate + }, changeTransformWithWidth() { this.styleTransformWithWidth?.style?.setProperty("transform", this.isTransitionStyleTransformWithWidth ? 'rotate(0deg)' -- GitLab