Vue2.0 项目实战语法—智能社
既然我跳进了前端的坑,就要有耐心,各个击破
一、安装配置依赖
1) vue init webpack—simple 项目名称
2) cnpm install
3 ) npm run dev
4 ) cnpm install vuex vue-router axios -D
5 ) cnpm install style-loader css—loader -D
6 ) 需要在 webpack.config.js 中加入
{
test: /\.css$/,
loader: ’style—loader!css-loader'
}
7 )
二、做 vue 项目流程
1) 规划组件结构 (Nav。vue、Header.vue、Home。vue)
2) 编写路由(vue—router)
3 ) 编写具体每个组件的功能
三、项目结构
1) 在 src 中建立 components 存放组件的文件夹
2) assets 存放
四、组件篇-comonents
1) 在 src 中建立 components 存放组件的文件夹
2) 在 components 中建立*.vue 文件
3 ) 在 App.vue 中导入*.vue (import NavView from ’./components/Nav.vue’)
4 ) export default{
components:{
NavView
1