javascript - vuejs页面加载完成后执行函数
问题描述
module.exports = {
data: function(){ return {memberQrcodeState: false }},components: {memberQrcode},created: function(){},beforeRouteEnter: function(to, from, next) { // 在渲染该组件的对应路由被 confirm 前调用 // 不!能!获取组件实例 `this` // 因为当钩子执行前,组件实例还没被创建 //$e.target.src= require('../imgs/test/232.jpg') next(); return true;},methods: { },beforeRouteLeave: function(to, from, next) { // 导航离开该组件的对应路由时调用 // 可以访问组件实例 `this` next();}
};
在这基础上加一个页面加载完成后执行的函数!我是小白,第二天接触vuejs,希望大神指点一二
问题解答
回答1:mounted(){ this.init()},methods:{ init(){console.log(’hello,world’) }}
谨供参考~
回答2:Vue2.0
mounted(){ console.log('页面加载完成')}回答3:
mounted
相关文章:
1. angular.js - 如何通俗易懂的解释“依赖注入”?2. java - Cannot resolve symbol ‘HttpServletRequest’3. angular.js - angularJs ngRoute怎么在路由传递空字符串及用ng-switch取得4. USE关键字5. php学习心得6. 请教包括一维、二维数组的遍历问题7. 老师能帮忙看是什么原因吗?网上找了好多都解决不了8. apache - mysql/ftp/服務器操作的權限9. mysql - 对于这两句sql,一个是用or,一个是用union all,性能应该是后面的好吧?10. node mysql 中 connection.query的问题
![angular.js - 如何通俗易懂的解释“依赖注入”?](http://www.haobala.com/attached/image/news/202311/101247a4a4.png)