詳談Vue.js框架下main.js,App.vue,page/index.vue之間的區(qū)別
如下所示:

1.index.html文件入口;
2.src放置組件和入口文件;
3.node_modules為依賴的模塊;
4.cofig中配置了路徑端口值等;
5.build中配置了webback的基本配置、開發(fā)環(huán)境配置、生產(chǎn)環(huán)境配置等。
main.js是我們的入口文件,主要用于初始化vue實例,并使用需要的插件。
App.vue是我們的主組件,所有的頁面都在App.vue下進行切換。我們可以將router標示為App.vue的子組件。
6.在每個模板中給style設置一個scoped屬性,意為該style的屬性只對這個組件起作用,不會影響到其他組件中含有相同class的元素。
補充知識:VUE 路由配置(包含main.js index.js APP.vue 三大配置)
main.js
import Vue from 'vue'
import App from './App'
import router from './router'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(Element);
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
src/router/index.js
import Vue from 'vue'
import Router from 'vue-router'
import Login from '../components/Login'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/Login',
name: 'Login',
component: Login
},
{
path:"/login1",
component:() => import('@/components/login1.vue')
}
],
mode: "history"http://干掉地址欄里邊的#號鍵
})
App.vue 展示Vue
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
name: 'App',
data () {
return {
}
}
}
</script>
<style>
</style>
以上這篇詳談Vue.js框架下main.js,App.vue,page/index.vue之間的區(qū)別就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
el-date-picker設置日期默認值兩種方法(當月月初至月末)
這篇文章主要給大家介紹了關于el-date-picker設置日期默認值(當月月初至月末)的相關資料,文中通過代碼示例將解決的辦法介紹的非常詳細,對大家的學習或者工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-08-08
elementui實現(xiàn)表格(el-table)默認選中功能
這篇文章主要介紹了elementui實現(xiàn)表格(el-table)默認選中功能,本文給大家分享實現(xiàn)思路結合實例代碼給大家介紹的非常詳細,需要的朋友參考下吧2024-07-07

