We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
如题,mixin里写了activate钩子,组件里也写了一个,按照文档mixin里的钩子会先于组件执行,事实上组件里的activate会先执行并且mixin里的钩子不会再次执行。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <button @click="toggleComp">I am a button</button> <component :is="currentView"></component> </body> <script src="vue.js"></script> <script> var mixin = { activate: function(done) { console.log('hook activate'); done(); } }; var vue = new Vue({ el:'body', data:{ currentView:'comp1' }, components:{ comp1:{ mixins:[mixin], template:'<h1>I am comp1</h1>', activate: function(done) { console.log('comp1 activate'); done(); } }, comp2:{ mixins:[mixin], template:'<h1>I am comp2</h1>', activate: function(done) { console.log('comp2 activate'); done(); } } }, methods:{ toggleComp:function() { this.currentView = this.currentView === 'comp1' ? 'comp2':'comp1' } } }) </script> </html>
![vue-issue](https://cloud.githubusercontent.com/assets/4529986/12847277/1d9b2cc4-cc4d-11e5-9e1d-0d6c6b36dcb9.png
The text was updated successfully, but these errors were encountered:
c63d6a3
No branches or pull requests
如题,mixin里写了activate钩子,组件里也写了一个,按照文档mixin里的钩子会先于组件执行,事实上组件里的activate会先执行并且mixin里的钩子不会再次执行。
![vue-issue](https://cloud.githubusercontent.com/assets/4529986/12847277/1d9b2cc4-cc4d-11e5-9e1d-0d6c6b36dcb9.png
The text was updated successfully, but these errors were encountered: