• Vue 项目结构介绍


    项目结构

    .

    ├── build      // 构建脚本   打包工具webpack有关的
    ├── config    // 全局配置   比如index.js:  端口配置
    ├── node_modules // 项目依赖模块
    ├── src         //项目源代码
    ├── static     // 静态资源
    ├── package.jspon // 项目信息和依赖配置

    └── package-lock.jspon // 项目信息和依赖配置的详细信息

    src
    ├── api // 各种接口
    ├── assets // 图片等资源
    ├── components // 各种公共组件,非公共组件在各自view下维护
    ├── icons //svg icon
    ├── router // 路由表
    ├── store // 存储
    ├── styles // 各种样式
    ├── utils // 公共工具,非公共工具,在各自view下维护
    ├── views // 各种layout
    ├── App.vue //***项目顶层组件***
    ├── main.js //***项目入口文件***
    └── permission.js //认证入口

    加载流程

    @ 代表src目录下

    1、main.js 

    import Vue from 'vue'
    import App from '@/App'
    import router from '@/router'  
    new Vue({
      el: '#app',   // 用来挂载页面的app元素
      router,       // 全写为 router:router
      template: '<App/>',  // App.vue 中的template
      components: { App }  // 全写为 App :App 
    })

    2、App.vue 

    <template>
      <div name="app">
        <router-view></router-view>  // 路由视图
         <router-link to='/hello'>to hello </router-link>
      </div >
    </template>
    
    <script>
      export default {
            name: 'App'
      }
    </script>
    

    3、index.js

    import Vue from 'vue'
    import Router from 'vue-router'

    import helloword from '@compont/helloword'

    import hello from '@compont/hello.'

    Vue.use(Router)
    export default router({
          routes:[
                    {
                     path: '/',
                     name: ''helloword,
                     componet: helloword
                    },
                   {
                     path: '/hello',
                     name: ''helloword,
                     componet: hello 
                    }
                 ]
    })

    4、hello.vue 

  • 相关阅读:
    软件测试行业5年经验,薪资不如刚入行的应届生,真是日了狗了,问题究竟出在哪里?
    【matlab图像处理】直方图均衡化操作
    js数组去重的六种方法
    MATLAB切片
    【 C++ 】多态
    VM虚拟机下载与安装
    java毕业设计网上汽车售票系统源码+lw文档+mybatis+系统+mysql数据库+调试
    Linux常见命令
    Python中的HTTP高手:如何玩转requests模块
    VB读写进程句柄-共享内存-内存映射CreateFileMapping
  • 原文地址:https://blog.csdn.net/qq_45763504/article/details/125492541