方法一
- 分别创建 index.js, index.css
index.js:
export default {data:function(){return {//...};},methods:{//...}
}
- index.vue 代码
<template>....
</template><script>
//index.js 的相对路径
import index from "./index.js";// 名字可以任取
export default index;
</script><style scoped>
//index.css 的相对路径
@import "./index.css";
</style>
方法二
直接引入
<template>....
</template>
//js的相对路径
<script src="./***.js"></script>
//css相对路径
<style src="./***.css"></style>