We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
本文一步一步讲解搭建的全过程,结合的是Ant Design,非详细版本,会在文末给出搭建的效果图~
Ant Design
进入正题啦,下午还有节目呢~
vue-cli
安装脚手架
$ npm install -g @vue/cli # OR $ yarn global add @vue/cli
创建一个项目
$ vue create antd-demo
文件内容的demo如下:
module.exports = { css: {} }
安装vue-router
npm install --save vue-router
src下面新建router/index.js
import Vue form 'vue' import Router from 'vue-router' Vue.use(Router) const router = new Router({ routes: [ { path: '/', name: 'index', component: resolve => require(['@/views/index'], resolve), meta: { name: '首页' } } ] })
在main.js中添加router
import VueRouter from 'vue-router' import router from './router/index' Vue.use(VueRouter) new Vue({ router, render: h => h(App), }).$mount('#app')
在入口的app.vue中添加router-view
<template> <div id="app"> <router-view/> </div> </template>
安装less和less-loader
npm install --save-dev less less-loader
在vue.config.js上配置支持
css: { loaderOptions: { less: { modifyVars: { blue: '#3a82f8', 'text-color': '#333' }, javascriptEnabled: true } } },
使用时候要注明lang='less'
<style scoped lang='less'> #index { h1 { background: blue; } } </style>
vue-anti-design地址
安装
$ npm i --save ant-design-vue
main.js中完整引入
import Vue from 'vue' import Antd from 'ant-design-vue' import App from './App' import 'ant-design-vue/dist/antd.css' Vue.config.productionTip = false Vue.use(Antd) /* eslint-disable no-new */ new Vue({ el: '#app', components: { App }, template: '<App/>' })
安装vuex
npm install vuex --save
新建一个store/index.js
import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: {}, mutations: {}, actions: {}, modules: {}, getters: {} }) export default store
在main.js中引入vuex
import store from './store/index' new Vue({ store, render: h => h(App) }).$mount('#app')
搭建的项目是响应式的,效果图这里我放上desktop版和mobile版:
desktop
mobile
更多的内容,请戳我的博客进行了解,能留个star就更好了💨
The text was updated successfully, but these errors were encountered:
No branches or pull requests
本文一步一步讲解搭建的全过程,结合的是
Ant Design
,非详细版本,会在文末给出搭建的效果图~进入正题啦,下午还有节目呢~
vue-cli@3创建项目
vue-cli
安装脚手架
$ npm install -g @vue/cli # OR $ yarn global add @vue/cli
创建一个项目
引入vue.config.js的配置
文件内容的demo如下:
引入vue-router
安装vue-router
src下面新建router/index.js
在main.js中添加router
在入口的app.vue中添加router-view
支持less
安装less和less-loader
在vue.config.js上配置支持
使用时候要注明lang='less'
引入vue-anti-design
vue-anti-design地址
安装
main.js中完整引入
引入vuex
安装vuex
新建一个store/index.js
在main.js中引入vuex
效果图
搭建的项目是响应式的,效果图这里我放上
desktop
版和mobile
版:desktop版
mobile版
参考和后话
更多的内容,请戳我的博客进行了解,能留个star就更好了💨
The text was updated successfully, but these errors were encountered: