All Projects → huyongyong1992 → Vue_axios_spa

huyongyong1992 / Vue_axios_spa

Licence: apache-2.0
基于vue2+axios+vux+vue-router+vuex构建的单页微信端项目

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue axios spa

Vue Music Player
🎵Vue.js写一个音乐播放器+📖One(一个).A music player + One by Vue.js
Stars: ✭ 729 (+1250%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Cnode
🔥Vue.js打造一个开源的CNode社区。CNode by Vue.js
Stars: ✭ 249 (+361.11%)
Mutual labels:  axios, vuex, vue-router, vue2
Todolist Frontend Vuejs
Front-end application for Todolist Web application built with Laravel and Vue.js
Stars: ✭ 120 (+122.22%)
Mutual labels:  axios, vuex, vue-router, spa
Vue2 Shop
A shop developed with Vue2 + Vue-router + Axios + Vuex + Node + Express + MongoDB + Webpack
Stars: ✭ 103 (+90.74%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Spa
vue-spa : vue + vue-router + axios + vuex + vux 快速成型移动端项目,直接使用。欢迎star
Stars: ✭ 46 (-14.81%)
Mutual labels:  axios, vuex, vue-router, spa
Seemusic
Vue 云音乐播放器,网易云音乐API,可听网易云高品质付费歌曲。 Vue music player
Stars: ✭ 112 (+107.41%)
Mutual labels:  axios, vuex, vue-router, vue2
Symfony Vuejs
Source code of the tutorial "Building a single-page application with Symfony 4 and Vue.js"
Stars: ✭ 170 (+214.81%)
Mutual labels:  axios, vuex, vue-router, spa
Vue Admin
基于Vue2、element ui、vue-cli、vuex、vue-router、axios 、echarts后台管理系统demo. 权限管理,用户管理,菜单管理。无限级菜单,下拉树形选择框
Stars: ✭ 1,135 (+2001.85%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Music
基于vue2.0的网易云音乐播放器,api来自于NeteaseCloudMusicApi,v2.0为最新版本
Stars: ✭ 855 (+1483.33%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Testing Examples
Advanced testing with vuejs. When you need to go beyond Getting started section and see some real world example with everything that proper tests should have.
Stars: ✭ 288 (+433.33%)
Mutual labels:  axios, vuex, vue-router, vue2
Vuedemo sell eleme
ele by vue2.x 🐧
Stars: ✭ 1,349 (+2398.15%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Quasar Admin
Vue 2.0 admin-dashboard based on Quasar-Framework
Stars: ✭ 516 (+855.56%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue2 Admin
基于vue-element-admin、Vue2 权限、监控、管理系统(包含地图等嵌套)
Stars: ✭ 74 (+37.04%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue2 Study
vue 的webpack配置,按需加载,element-ui,vuex
Stars: ✭ 16 (-70.37%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Mall
微信公众号测试项目
Stars: ✭ 74 (+37.04%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Cli Multi Page
基于vue-cli模板的多页面多路由项目,一个PC端页面入口,一个移动端页面入口,且有各自的路由, vue+webpack+vue-router+vuex+mock+axios
Stars: ✭ 145 (+168.52%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Home
🏠 A simple project(Vue Community SPA) which bases on vue+vue-cli+vue-router+axios+ scss.
Stars: ✭ 256 (+374.07%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue News
Vue2.5知乎日报单页应用
Stars: ✭ 300 (+455.56%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Qq
🎨 Vue family bucket with socket.io and express/koa2 , create a web version of mobile QQ, supporting real-time group chat, real-time private chat, special care, shielding chat, smart IP geographic location, real-time display temperature and other QQ core functions
Stars: ✭ 861 (+1494.44%)
Mutual labels:  axios, vuex, vue-router, vue2
Vue Admin Webapp
this is a admin project
Stars: ✭ 673 (+1146.3%)
Mutual labels:  axios, vuex, vue-router

vue-cli

官方脚手架

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for test env with minification
npm run test 

# build for uat env with minification
npm run uat 

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report
## 前后端数据交互之[axios](https://www.axios.com/)
#### 1.组件中调用

//从service的 getDta.js中引入你要调用的函数 import { getOrderList } from '../../service/getData';

export default { created(){//vue实例被创建后执行 this.getMsg(); //this指向vue实例 }, //该组件中所有执行函数均存放在这里 methods() { getMsg() { getOrderList({ params:params, //传参 }).then((data) =>{ //响应的结果 })
}, } }


#### 2.service/getData.js
import gitInfo from '../config/axios';    //引入封装好的axios组件
import { url } from '../config/env';      //引入接口baseUrl
export const getOrderList = (params) => getInfo(url+'具体接口路径',params,method);
//参数解释:
//params:组件中调用该方法传的参数
//url:接口路径
//method:请求方法
#### 3.axios.js

import axios from 'axios'; import router from '../router/router'

//设置全局axios默认值 axios.defaults.timeout = 15000; //15s的超时验证 axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';

// 创建axios实例 const fetch = axios.create();

const getInfo = (url='',data={},type='get') =>{ if(type === 'get'){ return fetch.get(url,data).then(function (resp) { if (resp.data.data && resp.data.data.accessToken) { //更新accessToken window.localStorage.setItem('accessToken', resp.data.data.accessToken); } return resp.data ; });
}

if (type === 'post') { 
        return fetch.post(url,data).then(function(resp) {
                if (resp.data.data && resp.data.data.accessToken) { //更新accessToken
                        window.localStorage.setItem('accessToken', resp.data.data.accessToken);
                }
                return resp.data;
        })
}

};

export { getInfo }

## UI
#### [UI库-vux](https://vux.li/#/)
## 公共函数 util.js
###### 获取url中的参数

export const getQuery = (key) => { const location = window.location; const query = {}; const params = location.href.split('?')[1] || ''; if (params) { params.split('&').forEach((item) => { const queryPair = item.split('='); query[queryPair[0]] = queryPair[1]; }); }

const rst = query[key];
//解码一个编码的 URI。
return rst ? window.decodeURIComponent(query[key]) : '';

}


### 移动端调试

// App.vue export default { created() { if(process.env.NODE_ENV === 'test') { //测试环境启用 let VConsole = require('vconsole'); this.vConsole = new VConsole(); } } }

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].