当前第2页 返回上一页
首先,在 .vue文件中设置如下:
1 2 3 | <template src= "./record.html" ></template>
<script src= "./record.js" ></script>
<style src= "./record.scss" ></style>
|
新建index.js文件,如下:
1 2 | import record from './record.vue' ;
export default record;
|
建立相对应的record.html、record.js、record.scss的文件,就可以了,拿.js来说:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | const name = 'record' ;
const data = function () {
return {
};
};
const computed = {
};
const components = {
}
const watch = {
};
const methods = {
};
function mounted() {
}
export default {
name: name,
data: data,
components: components,
computed: computed,
watch: watch,
methods: methods,
mounted: mounted
};
|
另一种方法可以直接引用:
1 2 3 4 5 | <template>
<div>html</div>
</template>
<script src= "./***.js" ></script>
<style src= "./***.css" ></style>
|
形式多样,但根本思想都是分离独立文件,引入加载
以上就是vue中如何分离css的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
click在vue里怎么实现
如何解决vue中layui报错问题
如何更好的理解vue的mvvm 模式?
浅谈vue中引入jquery的方法
浅析vue创建组件的几种方式
vue收费的吗
vue和js区别是什么
vue项目全局使用axios的方法介绍
什么是vue
浅谈vue中axios的封装
更多相关阅读请进入《vue》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » vue中如何分离css