Jac*_*kie 5 sass vue.js vue-material
我通过将以下内容添加到我的 index.js 文件中来使用 Vue Material default-dark 主题...
// index.js Where the vue instance is instantiated
import 'vue-material/dist/theme/default-dark.css';
...
import Vue from "vue";
...
Vue.use(VueRouter);
const routes = [
{
path: '/',
component: Viewport,
...
}
]
...
window.app.$mount('#jg-app');
Run Code Online (Sandbox Code Playgroud)
这很好用,但现在我想更改主题的颜色。为此,我将以下内容添加到我的模板中...
// viewport/Viewport.vue
<styles src="./Viewport.scss" lang="scss"></styles>
Run Code Online (Sandbox Code Playgroud)
并在 Viewport.scss (根据文档)...
# viewport/Viewport.scss
@import "~vue-material/dist/theme/engine"; // Import the theme engine
@include md-register-theme("default-dark", (
primary: md-get-palette-color(green, A200), // The primary color of your application
accent: md-get-palette-color(yellow, A200) // The accent or secondary color
));
@import "~vue-material/dist/theme/all";
Run Code Online (Sandbox Code Playgroud)
但是当我构建时,颜色并没有像我期望的那样改变。我看到该元素被标记为主要元素,但它仍然显示为蓝色。
我错过了什么?
我得到了它...
将 sass 更新为以下内容...
@import "~vue-material/dist/theme/engine";
@include md-register-theme("default", (
primary: md-get-palette-color(green, A200), // The primary color of your application
accent: md-get-palette-color(red, A200), // The accent or secondary color
theme: dark // This can be dark or light
));
@import "~vue-material/dist/theme/all";
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
9416 次 |
| 最近记录: |