vue-cli的执行流程

1.入口文件是main.js

模块的导出:export default {}
模块的导入:import Vue from 'vue'

2..vue文件是vue-cli把组件封装的单独文件

// 存放html, 一定要有一个根元素
//存放js, 一定要 export default {}
//存放css

3.添加自己的子组件

3.1 在src目录中传建一个文件夹:components
3.2 在components传建一个组件:demo.vue
3.3 在 demo.vue 中写入内容

			<template>
                <div></div>
            </template>
            <script>
                export default {
                    data() {
                        return {}
                    }
                }
            </script>
            <style></style>

3.4 在App.vue组件中导入子组件

3.5 将子组件注册到 app.vue 对象上

3.6 以自定义标签的方式来使用这个子组件

<template>
   <div>
		<Demo></Demo>
	</div>
</template>
import Demo from './components/demo.vue'
export default {
  data() {
     return {}
  },
  components: {
  	Demo
  }
}

你可能感兴趣的:(vue)