npm install -g @vue/cli
创建项目:
vue create my-project
# OR
vue ui
vue add element
vue add ......
如果要使用router功能,需要在其中加入标签<router-view></router-view>
:
<template>
<div id="app">
<navbar></navbar>
<router-view></router-view>
</div>
</template>
<script>
import navbar from "./components/navbar.vue";
export default {
name: "app",
components: {
navbar
}
};
</script>
<style>
</style>
index.html
是主页面- vue渲染其中
id=app
的模块 - 然后去看
App.vue
- 然后去看各种组件的组合。
- vue是组件式的。
- 通过add可以添加其他库
package.json
中包括各种命令生成。- 运行一个npm项目,基本
npm install
和看package.json
就行了