Pet*_*sev 4 css webpack vue.js vue-component vuejs2
我想将此toastr -library连接到我的组件中:
<script>
import toastr from 'toastr';
export default {
mounted(){
toastr.success('Hello from toastr!');
}
}
</script>
<template>
<div>
Template for my-component.vue here.
</div>
</template>
<style>
/* HOW TO IMPORT `toastr.css` FROM NODE_MODULES HERE?
</style>
Run Code Online (Sandbox Code Playgroud)
如何从 node_modules 目录连接库的 css?
hed*_*din 11
作为@LinusBorg建议这里的VUE装载机话题,您可以使用src-attribute内<style>-标签:
<script>
import toastr from 'toastr';
export default {
mounted(){
toastr.success('Hello from toastr!');
}
}
</script>
<template>
<div>
Template for my-component.vue here.
</div>
</template>
<style src='toastr/build/toastr.min.css'></style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5813 次 |
| 最近记录: |