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. php - 第三方支付平臺在很短時間內多次異步通知,訂單多次確認收款2. html5 - h5寫的app用的webview,用手機瀏覽器打開不顯示?3. css3 - css before 中文亂碼?4. Mysql && Redis 并發問題5. javascript - node服務端渲染的困惑6. javascript - 百度echarts series數據更新問題7. javascript - webpack --hot 熱重載無效的問題8. mysql新建字段時 timestamp NOT NULL DEFAULT ’0000-00-00 00:00:00’ 報錯9. mysql scripts提示 /usr/bin/perl: bad interpreter10. mysql - 一個表和多個表是多對多的關系,該怎么設計
