前端主题切换思路

1.给背景色的元素统一class

操作dom式:页面初始化从localstorage取出theme,getElementsBydom得到数组遍历修改其style dom.cssText.backgroundcolor

2,vue式

定义全局theme变量存颜色  style和class动态绑定theme

3.less 

window.less.modifyVars({

‘ @theme’:‘WHITE’

})

猜你喜欢

转载自blog.csdn.net/weixin_42176561/article/details/89456904