search

Home  >  Q&A  >  body text

javascript - Execute function after vuejs page is loaded

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();
}

};

On this basis, add a function to be executed after the page is loaded! I'm a novice, I came into contact with vuejs the next day, I hope someone can give me some advice

我想大声告诉你我想大声告诉你2719 days ago965

reply all(3)I'll reply

  • 巴扎黑

    巴扎黑2017-06-21 10:14:36

    mounted(){
        this.init()
    },
    methods:{
        init(){
            console.log('hello,world')
        }
    }

    For reference only~

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-06-21 10:14:36

    Vue2.0

    mounted(){
        console.log("页面加载完成")
    }

    reply
    0
  • 習慣沉默

    習慣沉默2017-06-21 10:14:36

    mounted

    reply
    0
  • Cancelreply