1、在皮肤最顶层 做一个classname来标示如darklight..dark button { color: white; background: dark; }.light button { color: dark; background: gray; }
2、这种方式的好处在于, 不用加载额外css, 只需要改变顶层的classname就可以达到切换皮肤的效果
3、通过动态修改link<link href="theme.default.css" /><link href="theme.dark.css" id="J-theme-link" />
4、theme.light.cssbutton { color: white; background: dark; }
5、theme.dark.cssbutton { color: dark; background: gray; }
6、js控制function changeTheme(type) { var el = doucment.querySelector('J-theme-link'); el.href = themeUrl + '/theme.' + type + '.css'; }