Blogger Information
Blog 56
fans 7
comment 11
visits 222708
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
微信小程序动态修改wxss动态传值给wxss文件
樂成的开发笔记
Original
1985 people have browsed it

1、常见的属性修改可以直接在wxml文件修改

js文件
data: {
  width:90,
  height:'height:90rpx'
},
wxml文件
<view style="width:{{width}}rpx;{{height}}"></view>


2、另外一种是传值到wxss文件,主要是修改 比如动画的@keyframes

wxml文件
<view class="luck" style="--luckdeg--:rotate(540deg);"></view>

wxss文件
.luck{
  width:90rpx;
  height:90rpx;
  animation: zhuan 2s forwards;
}

@keyframes zhuan{
  0%{
    transform: rotate(0deg);
  }
  100%{
    transform:var(--luckdeg--);
  }
}

亲测在当前标签上,或者包含该标签的上层标签传值都可以

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post