我有一个带有深色主题切换的类星体项目。但如果使用深色模式,我想改变整个配色方案。
我对sass一无所知,我想知道可以通过在用户更改主题时更新sass变量来完成。
src/css/quasar.variables.sass这是(浅色主题)中定义的实际 sass 变量:
// Quasar Sass (& SCSS) Variables
// --------------------------------------------------
// To customize the look and feel of this app, you can override
// the Sass/SCSS variables found in Quasar's source Sass/SCSS files.
// Check documentation for full list of Quasar variables
// Your own variables (that are declared here) and Quasar's own
// ones will be available out of the box in your .vue/.scss/.sass files
// It's highly recommended to change the default colors
// …Run Code Online (Sandbox Code Playgroud) 我想有条件地在对象上创建属性。这个想法是确保该属性在没有值的情况下不存在(因此不仅仅是 null)。
我现在正在做什么:
// comes from users
req.query = {
foo: true
}
// my object which will contains allowed properties IF EXISTS
const where = {}
if (req.query.foo) {
where.foo = req.query.foo
}
if (req.query.bar) {
where.bar = req.query.bar
}
console.log(where)Run Code Online (Sandbox Code Playgroud)
对每个不同的属性重复这个真的很无聊......
有没有一种方法可以在一行中完成?
编辑:
我不想获取所有属性req.query