在 Scss 中的 Noty 导入中找不到导入或无法读取错误

问题描述

当我在 app.scss 文件中导入 noty 模块时,我的终端出现错误消息。我使用 $ yarn add noty 安装了 noty。

@import “~noty/src/noty.scss”; 
@import “~noty/src/themes/mint.scss”;

错误要导入的文件未找到或无法读取:~noty/src/noty.scss。

然后尝试使用 Cdn 但在我的 layout.js 中

<script src ="https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.js"></script>

但它仍然给出相同的错误

这是我的javascript代码

let addToCart = document.querySelectorAll('.add-to-cart');
let cartCounter = document.querySelector('#cartCounter');
function updateCart(pizza){

    axios.post('/update-cart',pizza).then(res =>{

    console.log(res);
    cartCounter.innerText = res.data.totalQty
    new Noty({
        type: 'success',timeout: 1000,text: 'Item added to cart',progressBar: false,}).show();


    })

}


addToCart.forEach((btn) =>{

btn.addEventListener('click',(e)=>{
let pizza = JSON.parse(btn.dataset.pizza);
updateCart(pizza);
console.log(pizza);

})

})

Please help to solve the error or else suggest some other way to use and import noty themes in my project.



解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)