# mobileModule **Repository Path**: this_is_admin/mobileModule ## Basic Information - **Project Name**: mobileModule - **Description**: 移动端 vue vant 模板 - **Primary Language**: JavaScript - **License**: Zlib - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2020-05-27 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mobile-module > A Vue.js project ## Build Setup ``` bash # install dependencies npm install # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build # build for production and view the bundle analyzer report npm run build --report ``` UI框架 [vant](https://youzan.github.io/vant/#/zh-CN/quickstart) #src目录结构 参考[element-admin](https://panjiachen.github.io/vue-element-admin-site/zh/) ``` api->接口文件夹 assets->css文件,图片,js插件目录 components->组件 router->路由文件夹 store->vuex文件 utils->插件目录 view->界面组件 ``` #调用接口的案例 参考[element-admin](https://panjiachen.github.io/vue-element-admin-site/zh/) ``` api 文件夹 home.js(可以新建多个js文件) //引用 axios 封装的请求方法 import request from '@/utils/request' //暴露请求方法 export function err(data) { return request({ url: '/err', method: 'get', data }) } store的封装 详情了解vuex文档 //引入 import {err} from '@/api/home' const state = { }; const mutations = { }; const actions = { err({commit},data){ return new Promise((resolve, reject) => { err(data).then(res => { resolve(res) }).catch(err => { reject(err) }) }) } }; export default { namespaced: true, state, mutations, actions } 最后err页面的调用 this.$store.dispatch('home/err',data).then(res=>{ }).catch(err=>{ }) ```