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. android - 请问一下 类似QQ音乐底部播放 在每个页面都显示 是怎么做的?2. thinkPHP5中获取数据库数据后默认选中下拉框的值,传递到后台消失不见。有图有代码,希望有人帮忙3. mysql主从 - 请教下mysql 主动-被动模式的双主配置 和 主从配置在应用上有什么区别?4. 求救一下,用新版的phpstudy,数据库过段时间会消失是什么情况?5. python小白 关于类里面的方法获取变量失败的问题6. python - vscode 如何在控制台输入7. django - Python error: [Errno 99] Cannot assign requested address8. python小白,关于函数问题9. Python2中code.co_kwonlyargcount的等效写法10. [python2]local variable referenced before assignment问题
