vue里面各文件说明

来源:互联网 发布:适合抓握的鼠标 知乎 编辑:程序博客网 时间:2024/06/05 05:09

vue文件说明

文件结构

1、main.js是我们的入口文件,主要作用是初始化vue实例,并使用我们需要的插件

import Vue from 'vue'import App from './App'import router from './router'/* eslint-disable no-new */new Vue({  el: '#app',  router,  template: '<App/>',  components: { App }})

2、App.vue是我们的跟组件,所有页面都是在App.vue下面进行切换的,可以理解为所有的组件都是App.vue的子组件,我们可以吧头部课底部及每个页面都出现的内容放在App.vue里面。

<template>  <div id="app">    <img src="./assets/logo.png">    <hello></hello>  </div></template><script>import Hello from './components/Hello'export default {  name: 'app',  components: {    Hello  }}</script><style>#app {  font-family: 'Avenir', Helvetica, Arial, sans-serif;  -webkit-font-smoothing: antialiased;  -moz-osx-font-smoothing: grayscale;  text-align: center;  color: #2c3e50;  margin-top: 60px;}</style>

3、index.html文件入口

4、src放置组件和入口文件

5、node_modules为依赖的模块

6、config中配置了路径端口值等

7、build中配置了webpack的基本配置、开发环境配置、生产环境配置等

原创粉丝点击