mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
[new feature] Tab support vue-router (#305)
* fix: Tabbar icon line-height * [new feature] progress add showPivot prop * [new feature] TabItem support vue-router
This commit is contained in:
22
packages/mixins/router-link.js
Normal file
22
packages/mixins/router-link.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* add Vue-Router support
|
||||
*/
|
||||
|
||||
export default {
|
||||
props: {
|
||||
url: String,
|
||||
replace: Boolean,
|
||||
to: [String, Object]
|
||||
},
|
||||
|
||||
methods: {
|
||||
routerLink() {
|
||||
const { to, url, $router, replace } = this;
|
||||
if (to && $router) {
|
||||
$router[replace ? 'replace' : 'push'](to);
|
||||
} else if (url) {
|
||||
replace ? location.replace(url) : location.href = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user