vue & vue router & dynamic router

https://router.vuejs.org/guide/essentials/dynamic-matching.html#reacting-to-params-changes

old

https://router.vuejs.org/api/#the-route-object


const User = {
template: '...',
watch: {
'$route' (to, from) {
// react to route changes...
}
}
}

new

https://router.vuejs.org/guide/advanced/navigation-guards.html


const User = {
template: '...',
beforeRouteUpdate (to, from, next) {
// react to route changes...
// don't forget to call next()
}
}

history-mode

404

asterisk (*):


{
// will match everything
path: '*'
}
{
// will match anything starting with `/user-`
path: '/user-*'
}

* & pathMatch


// Given a route { path: '/user-*' }
this.$router.push('/user-admin')
this.$route.params.pathMatch // 'admin' // Given a route { path: '*' }
this.$router.push('/non-existing')
this.$route.params.pathMatch // '/non-existing'

https://router.vuejs.org/guide/essentials/dynamic-matching.html#catch-all-404-not-found-route

https://router.vuejs.org/guide/essentials/history-mode.html

https://github.com/pillarjs/path-to-regexp#parameters


/user/:id !== /user:id

typo bug


vue & vue router & dynamic router的更多相关文章

  1. vue & this.$route & this.$router

    vue & this.\(route & this.\)router const User = { template: '<div>User</div>' } ...

  2. vue工程化与路由router

    一.介绍     vue.js 是 目前 最火的前端框架,vue.js 兼具 angular.js 和 react.js 的优点,并剔除它们的缺点.并且提供了很多的周边配套工具 如vue-router ...

  3. vue & vue router & match bug

    vue & vue router & match bug match bugs solution name must be router https://stackoverflow.c ...

  4. [vue]vue路由篇vue-router

    spa单页开发及vue-router基础: https://www.cnblogs.com/iiiiiher/p/9034496.html url两种传参方式 query: $route.query ...

  5. Vue Vue.use() / Vue.component / router-view

    Vue.use Vue.use 的作用是安装插件 Vue.use 接收一个参数 如果这个参数是函数的话,Vue.use 直接调用这个函数注册组件 如果这个参数是对象的话,Vue.use 将调用 ins ...

  6. router.go,router.push,router.replace的区别

    除了使用 <router-link> 创建 a 标签来定义导航链接,我们还可以借助 router 的实例方法,通过编写代码来实现.当你点击 <router-link> 时,这个 ...

  7. Javascript - Vue - vue对象

    vue提供了一整套前端解决方案,可以提升企业开发效率 vue的处理过程 app.js 项目入口,所有请求最先进入此模块进行处理 route.js 由app.js调用,处理路由的分发 controlle ...

  8. Vue - vue.js 常用指令

    Vue - vue.js 常用指令 目录: 一. vuejs模板语法之常用指令 1. 常用指令: v-html 2. 常用指令: v-text 3. 常用指令: v-for 4. 常用指令: v-if ...

  9. 前端开发 Vue Vue.js和Nodejs的关系

    首先vue.js 是库,不是框架,不是框架,不是框架. Vue.js 使用了基于 HTML 的模版语法,允许开发者声明式地将 DOM 绑定至底层 Vue 实例的数据. Vue.js 的核心是一个允许你 ...

随机推荐

  1. 两个list<Map<String,String>>放入一个list中

    // public static void main(String[] args) {// List<Map<String, String>> list2 = new Arra ...

  2. I/O 复用 multiplexing data race 同步 coroutine 协程

    小结: 1.A file descriptor is considered ready if it is possible to perform the corresponding I/O opera ...

  3. 【算法】ST表

    想学习一下LCA倍增,先 水一个黄题 学一下ST表 ST表 介绍: 这是一个运用倍增思想,通过动态规划来计算区间最值的算法 算法步骤: 求出区间最值 回答询问 求出区间最值: 用f[i][j]来存储从 ...

  4. BZOJ1031

    前一段时间终于看明白了后缀数组,记录一下主要的做过的题目,主要的按照黄学长的BLOG作的,主要是为了记模板.原理还是上网自己查一下吧!代码会加简单的注释. ********************** ...

  5. JavaWeb——过滤器及监听器

    什么是过滤器? 过滤器示意图 Filter是如何实现拦截的? Filter的生命周期 Filter的创建 Filter的销毁 FilterConfig接口 Servlet过滤器有关接口 过滤器配置 F ...

  6. Spring boot freemarker 配置

    spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.jdbc.Dri ...

  7. Nacos服务心跳和健康检查源码介绍

    服务心跳 Nacos Client会维护一个定时任务通过持续调用服务端的接口更新心跳时间,保证自己处于存活状态,防止服务端将服务剔除,Nacos默认5秒向服务端发送一次,通过请求服务端接口/insta ...

  8. Pytest(2)使用和调用方法

    Pytest执行用例规则 Pytest在命令行中支持多种方式来运行和选择测试用例 1.对某个目录下所有的用例 pytest 2.对模块中进行测试 pytest test_mod.py 3.对文件夹进行 ...

  9. Eclipse无法查看Servlet源代码的解决方案

    在Apache官方网站中选择你对应的tomacat版本下载对应的Tomcat的源码 下载Source Code Distributions下的zip 将下载的zip文件复制到lib文件夹下 在提示页面 ...

  10. A - A Gifts Fixing

    t组询问,每次给出数列长度n 以及两个长度为n的数列{ai​}和{bi​}. 有三种操作:ai​−1, bi​−1以及ai​,bi​同时− 1 -1−1. 问最少多少步以后可以让两个数列变成常数数列. ...