javascript - vuejs頁面加載完成后執(zhí)行函數(shù)
問題描述
module.exports = {
data: function(){ return {memberQrcodeState: false }},components: {memberQrcode},created: function(){},beforeRouteEnter: function(to, from, next) { // 在渲染該組件的對應路由被 confirm 前調(diào)用 // 不!能!獲取組件實例 `this` // 因為當鉤子執(zhí)行前,組件實例還沒被創(chuàng)建 //$e.target.src= require('../imgs/test/232.jpg') next(); return true;},methods: { },beforeRouteLeave: function(to, from, next) { // 導航離開該組件的對應路由時調(diào)用 // 可以訪問組件實例 `this` next();}
};
在這基礎上加一個頁面加載完成后執(zhí)行的函數(shù)!我是小白,第二天接觸vuejs,希望大神指點一二
問題解答
回答1:mounted(){ this.init()},methods:{ init(){console.log(’hello,world’) }}
謹供參考~
回答2:Vue2.0
mounted(){ console.log('頁面加載完成')}回答3:
mounted
相關(guān)文章:
1. angular.js - angular內(nèi)容過長展開收起效果2. dockerfile - [docker build image失敗- npm install]3. golang - 用IDE看docker源碼時的小問題4. 在windows下安裝docker Toolbox 啟動Docker Quickstart Terminal 失敗!5. docker-compose中volumes的問題6. docker內(nèi)創(chuàng)建jenkins訪問另一個容器下的服務器問題7. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題8. mac里的docker如何命令行開啟呢?9. nignx - docker內(nèi)nginx 80端口被占用10. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?

網(wǎng)公網(wǎng)安備