css - 在 buefy 和 bulma 中设置 $primary color 时出现问题

标签 css vue.js sass bulma buefy

vue2中Buify bulma问题

我在使用 buify/bulma 设置 $primary color 时遇到问题。

问题似乎是更改最终出现在生成的 css 文件中 默认颜色是紫色#7957d5 我已将变量 $ Primary 设置为粉色 # 3e912ba

对于完全相同的元素,它会生成几种不同的颜色,其中标准在第 14617 行,最小变化为 12241 请参阅蓝色箭头 ->

css inspector of the dom

整个设置是:

  • VUE 2“vue”:“^2.6.11”,
  • SASS DART “sass”:“^1.26.5”,“sass-loader”:“^8.0.2”,
  • Buefy“buefy”:“^0.9.10”,
  • 导入 bool 玛

在 SCSS 文件中,我为 buefy 和 bulma 设置了颜色变量,如 the offical doc 所示。

    @import '~bulma/sass/utilities/all';
// Set your colors
$primary: #e912ba;
$primary-light: findLightColor($primary);
$primary-dark: findDarkColor($primary);
$primary-invert: findColorInvert($primary);
$twitter: #4099FF;
$twitter-invert: findColorInvert($twitter);

// Lists and maps
$custom-colors: $primary;
$custom-shades: null !default;

// Setup $colors to use as bulma classes (e.g. 'is-twitter')
$colors: mergeColorMaps(
    (
        "primary": (
            $primary,
            $primary-invert,
            $primary-light,
            $primary-dark,
        ),
      
    ),
    $custom-colors
);

// Links
$link: $primary;
$link-invert: $primary-invert;
$link-focus-border: $primary;

// Import Bulma and Buefy styles
@import '~bulma';
@import '~buefy/src/scss/buefy';

在 app.vue 中我导入了 scss

<style lang="scss">
@import "./css/style.scss";
</style>

生成了三个不同的css文件,其中head中的第一个文件是保存我在$primary中所做的更改的文件。最后一个是我找到 buefy $primary color 的默认值的地方。

head link css-sheets

最佳答案

原来问题是我在main.js文件中导入了buefy.css 导入'buefy/dist/buefy.css' 当我删除它时,它起作用了。

关于css - 在 buefy 和 bulma 中设置 $primary color 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69652951/

相关文章:

css - Bootstrap 媒体查询在 LESS 导入中的选择器内?

vue.js - Vuetify 使用带有来自 API 的外部数据的数据表和 Vuex

css - Bootstrap-vue 崩溃 : show state with arrow

vue.js - 如何在vuejs中集成jsplumb?

sass - 在 Bootstrap 5 中使用 SCSS 导入间距(边距、填充等)

css - 使用 Angular 的动态样式导入

css - 为什么我有水平滚动条?

html - CSS 假表 div,在 div 内扩展以填充总宽度的 100%

php - php 中的 css 编辑器,类似于 wordpress css 编辑器

html - 如何覆盖禁用的超链接样式?