就是在wxss中引用另一份wxss,具体wxss位置由js或wxs控制
比如
@import {{url}}//这个写法肯定不行,有没有能够实现的方法
能不能用js改变wxss引用?Is it possible to change the wxss reference with js?
能不能用js改变wxss引用?就是在wxss中引用另一份wxss,具体wxss位置由js或wxs控制
比如
@import {{url}}//这个写法肯定不行,有没有能够实现的方法
It refers to another wxss in wxss. The specific wxss location is controlled by JS or WXS. For example, @ import {URL}} / / this writing method is definitely not good. Is there a method that can be implemented
回答:
// page.wxml<view class="{{theme}}"> <view>content</view></view>// page.jsPage({ data: { theme: "dark" }})// app.wxss.light { color: "#000000"}.dark { color: "#ffffff"}
直接引就行~
原文出处:能不能用js改变wxss引用?
不能,要做切换主题,只能通过动态改变class来实现