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

Global mixin router cause stack exceeded #13

Open
zthxxx opened this issue Oct 5, 2017 · 0 comments
Open

Global mixin router cause stack exceeded #13

zthxxx opened this issue Oct 5, 2017 · 0 comments
Assignees
Labels

Comments

@zthxxx
Copy link
Owner

zthxxx commented Oct 5, 2017

import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router);

const user = {
  template: `
    <div class="user">
      <h2>User</h2>
      <router-view></router-view>
    </div>
  `
};

const routes = [
  {
    path: '/user',
    component: user,
  }
];
const router = new Router({routes});

Vue.mixin({
  router
});

new Vue({
  el: '#app',
  template: `
    <div>
      <router-view></router-view>
    </div>
  `
});

全局混合 vue-router 将引起 user 中的 router-view 爆栈,原因未知,解决办法只能是不使用全局混合,改成单独注入:

Vue.mixin({
  
});

new Vue({
  el: '#app',
  router,
});

坏处是这样之后使用 new Vue.extend() 新建的实例中无法使用 $route

@zthxxx zthxxx added the To Learn label Oct 5, 2017
@zthxxx zthxxx self-assigned this Oct 5, 2017
zthxxx added a commit to zthxxx/prinalysis that referenced this issue Oct 5, 2017
1. Update api docs of order state
2. Add api docs of order amount
3. Add api code of order amount
4. Add component of OrderList
5. Adjust a global mixin router problem

refs:  #14  zthxxx/wiki-site#13
zthxxx added a commit to zthxxx/prinalysis that referenced this issue Oct 6, 2017
1. Update api docs of order state
2. Add api docs of order amount
3. Add api code of order amount
4. Add component of OrderList
5. Adjust a global mixin router problem

refs:  #14  zthxxx/wiki-site#13
zthxxx added a commit to zthxxx/prinalysis that referenced this issue Oct 6, 2017
1. Update api docs of order state
2. Add api docs of order amount
3. Add api code of order amount
4. Add component of OrderList
5. Adjust a global mixin router problem

refs:  #14  zthxxx/wiki-site#13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant