10 examples of 'vue router push params' in JavaScript

Every line of 'vue router push params' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
51onPush(route: Route, props:{ [key: string]: any}):boolean {
52 this.refs.nav.push({...route, component:RouteIOS, passProps:{...props, route: route}});
53 return true;
54}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

19push(props, route) {
20 if(!props){
21 props = {};
22 }
23 route.props = props;
24 this.navigator.push(route);
25}
28push(props, route) {
29 let routesList = this.navigator.getCurrentRoutes()
30 let nextIndex = routesList[routesList.length - 1].index + 1
31 route.props = props
32 route.index = nextIndex
33 this.navigator.push(route)
34}
56export function push(routeName: string, params?: NavigationParams) {
57 if (navigationContainer && lastNavigateTime + 500 < Date.now()) {
58 navigationContainer.dispatch(
59 StackActions.push({
60 routeName,
61 params,
62 }),
63 );
64 lastNavigateTime = Date.now();
65 }
66}
83initRouter (routerOptions) {
84 assert(isObject(routerOptions), `lue.router: vue-router options should be a object.`);
85 assert(!isDef(routerOptions['routes']), `lue.router: routes prop of vue-router options should be defined.`);
86 assert(Array.isArray(routerOptions['routes']), `lue.router: routes prop of vue-router options should be a array.`);
87
88 this.router = new VueRouter(routerOptions);
89}
18push(component: any, params?: { [key: string]: any }, transition?: PageTransition) {
19 this.params = params;
20 this.navigationService.publish(component, this.host, transition);
21}
36push: function push() {
37 var pass = validatePushForm();
38 if (pass) {
39 app.dialogFormVisible = false;
40 axios.post(ctxPath + '/app/push', app.pushForm).then(function (response) {
41 console.log(response);
42 app.$message({
43 message: '发送即时消息成功',
44 type: 'success',
45 center: true
46 });
47 }).catch(function (error) {
48 console.log(error);
49 });
50 }
51}
40export function push({
41 routeName,
42 params,
43 action,
44}: {
45 routeName: string;
46 params?: object;
47 action?: never;
48}): StackActionType {
49 if (action !== undefined) {
50 throw new Error(
51 'Sub-actions are not supported for `push`. Remove the `action` key from the options.'
52 );
53 }
54
55 return StackActions.push(routeName, params);
56}
18onPop(num: number = 1, route:Route, props:{ [key: string]: any}): boolean {
19 return true;
20}
11export function createRouter() {
12 const router = new VueRouter({
13 mode: 'history',
14 scrollBehavior: (to, from, savedPosition) => {
15 if (savedPosition) {
16 return savedPosition;
17 } else {
18 return { x: 0, y: 0 };
19 }
20 },
21 routes: [
22 { path: '/', component: List },
23 { path: '/article/:id', component: Article, meta: { scrollToTop: true } },
24 { path: '/page/:page', component: List },
25 { path: '*', redirect: '/' },
26 ],
27 });
28 if (typeof window !== 'undefined') {
29 router.afterEach((to, from) => {
30 if (document && !(/\/article\//g.test(to.path))) {
31 document.querySelector('title').innerText = 'HJM\'s Blog';
32 }
33 });
34 }
35 return router;
36}

Related snippets