【问题标题】:How to add css in Vue-Toasted?如何在 Vue-Toasted 中添加 css?
【发布时间】:2021-02-10 00:59:41
【问题描述】:

我正在尝试添加以下 css,但它不起作用。我想我会按照文档进行。

https://www.npmjs.com/package/vue-toasted

以下方法均无效。

正在使用的函数@click 的 div。

showToast(){
   this.$toasted.show('Email Sent!',{
        position: "top-right", 
        duration : 5000,
        class: 'toasting'
      });

showToast(){
   this.$toasted.show('Email Sent!',{
        position: "top-right", 
        duration : 5000,
        className: ['toasting']
      });

风格

.toasting {
  color: yellow;
  background-color: pink;

}

【问题讨论】:

  • Vue.use(Toasted)了吗?

标签: javascript vue.js vue-toasted


【解决方案1】:

默认 CSS 应被您的 CSS 覆盖。所以你需要在你的CSS中使用!important。这是css:

<style>
.toasting {
  color: yellow !important;
  background-color: pink !important;
}
</style>

工作demo

【讨论】:

  • 嘿,尽管它在小提琴中工作。由于某种原因,它在我的项目中不起作用。
  • 检查 css 应用的规则到 devtool 中
猜你喜欢
  • 1970-01-01
  • 2018-09-01
  • 2020-12-27
  • 1970-01-01
  • 2020-01-01
  • 1970-01-01
  • 2018-01-03
  • 1970-01-01
  • 2021-09-11
相关资源
最近更新 更多