上面是一个vue-cli的目录结构(不带路由)
主要分析index.html main.js App.vue HelloWorld.vue的关系
index.html:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>my-project</title> </head> <body> <div id="app"></div> <!-- built files will be auto injected --> </body> </html>
里面有id为app的div
main.js:
// The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' import App from './App' Vue.config.productionTip = false /* eslint-disable no-new */ new Vue({ el: '#app', components: { App }, templat