Vue.js 如何更改Vue材质主题的颜色

Vue.js 如何更改Vue材质主题的颜色,vue.js,sass,vue-material,Vue.js,Sass,Vue Material,我正在使用Vue材质默认暗主题,将以下内容添加到我的index.js文件中 // 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: '/', componen

我正在使用Vue材质默认暗主题,将以下内容添加到我的index.js文件中

// 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');
这是伟大的作品,但现在我想改变主题的颜色。为此,我在模板中添加了以下内容

// viewport/Viewport.vue

<styles src="./Viewport.scss" lang="scss"></styles> 
但是,当我建立的颜色没有改变,因为我会期待。我看到元素被标记为primary,但它仍然显示为蓝色


我缺少什么?

您的主要部件是什么样子的

是否在vue材质组件md theme=“默认暗”中的某个位置使用


我的头衔
....
或者,您只需将其添加到以下部件:

<md-content md-theme="default-dark">

我明白了

  • 删除了导入
  • 将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";
    

  • 还必须能够与网页一起使用可能应该是评论而不是答案;-)。我使用
    import'vue material/dist/theme/default dark.css'将主题添加到我的页面中我也不使用我使用的md应用程序<代码>window.app.$mount('jg-app')&我试图将md主题添加到我的路由根目录中,但没有成功。按照相同的过程,但出现此错误“找不到”~vue material/dist/theme/engine“您是否运行了
    npm安装--保存vue material
    ,而且这已经有一段时间了,请告诉我它是否不再工作了
    <md-content md-theme="default-dark">
    
    @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";