Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多开相同的Page后,点返回,router.query不对 #15

Open
maimake opened this issue Jul 10, 2018 · 5 comments
Open

多开相同的Page后,点返回,router.query不对 #15

maimake opened this issue Jul 10, 2018 · 5 comments

Comments

@maimake
Copy link

maimake commented Jul 10, 2018

打开页面 : pages/xxx?id=1
然后
打开页面 : pages/xxx?id=2
然后
返回

this.$route.query 里还是id = 2

另外 router 的 beforeEach 能否也考虑设计下?跳转登录的,没有这个比较蛋疼

@laoboxie
Copy link

希望作者能完成导航守卫的功能

@bravelincy
Copy link

碰到类似的问题,返回再进入不同id的相同页面组件,computed里的id () {return this.$route.query.id}不会重新被计算

@luckyyyyy
Copy link

其实挺好改的

增加了 const query = _$mp.page && _$mp.page.options;

const parseRoute = ($mp) => {
  const _$mp = $mp || {};
  const path = _$mp.page && _$mp.page.route;
  const query = _$mp.page && _$mp.page.options;
  return {
    path: `/${path}`,
    params: {},
    query,
    hash: '',
    fullPath: parseUrl({
      path: `/${path}`,
      query,
    }),
    name: path && path.replace(/\/(\w)/g, ($0, $1) => $1.toUpperCase())
  };
};

@zhoufanglu
Copy link

请问这个问题有什么方法可以解决吗?我现在也遇到了,真坑。

@mack-wang
Copy link

1、将业务逻辑改成重新获取数据,而不是重复跳转到相同界面。
2、如果一定要有返回,则改写返回的逻辑。
比如1->2->3,则在vuex中实现history,先将自己的3->2->1处理完成,然后才处理back()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants