<!-- my-component.vue -->
<template>
<div>This will be pre-compiled</div>
</template>
<script src="./my-component.js"></script>
<style src="./my-component.css"></style>
- 需要注意的是css文件引入的时候不要用@import
<style lang="scss" scoped>
@import "../assets/scss/app.scss";
</style>
<!-- @import的css作用域是全局,如何解决?见如下 -->
<style lang="scss" scoped src="../assets/scss/app.scss"></style>