vue-location
这是一个Vue2.x的一个处理URL的工具
Install
npm install vue-location --save
Usage
import Vue from 'vue'
import VueLocation from 'vue-location'
Vue.use(VueLocation);
Example
// url: localhost:8080/#/user/orders
this.$location.url(); // return '/user/orders'
this.$location.url('/about'); // localhost:8080/#/about
this.$location.url('about'); // localhost:8080/#/user/about
// url: localhost:8080/#/user/orders?page=1
this.$location.search(); // return { page: 1 }
this.$location.search({ pagesize: 10 }); // localhost:8080/#/user/orders?page=1&pagesize=10
this.$location.search({ pagesize: 10, page: 2 }); // localhost:8080/#/user/orders?page=2&pagesize=10
this.$location.clear(); // localhost:8080/#/user/orders