javascript - vuejs頁(yè)面加載完成后執(zhí)行函數(shù)
問(wèn)題描述
module.exports = {
data: function(){ return {memberQrcodeState: false }},components: {memberQrcode},created: function(){},beforeRouteEnter: function(to, from, next) { // 在渲染該組件的對(duì)應(yīng)路由被 confirm 前調(diào)用 // 不!能!獲取組件實(shí)例 `this` // 因?yàn)楫?dāng)鉤子執(zhí)行前,組件實(shí)例還沒(méi)被創(chuàng)建 //$e.target.src= require('../imgs/test/232.jpg') next(); return true;},methods: { },beforeRouteLeave: function(to, from, next) { // 導(dǎo)航離開該組件的對(duì)應(yīng)路由時(shí)調(diào)用 // 可以訪問(wèn)組件實(shí)例 `this` next();}
};
在這基礎(chǔ)上加一個(gè)頁(yè)面加載完成后執(zhí)行的函數(shù)!我是小白,第二天接觸vuejs,希望大神指點(diǎn)一二
問(wèn)題解答
回答1:mounted(){ this.init()},methods:{ init(){console.log(’hello,world’) }}
謹(jǐn)供參考~
回答2:Vue2.0
mounted(){ console.log('頁(yè)面加載完成')}回答3:
mounted
相關(guān)文章:
1. golang - 用IDE看docker源碼時(shí)的小問(wèn)題2. docker images顯示的鏡像過(guò)多,狗眼被亮瞎了,怎么辦?3. 前端 - @media query 使用出現(xiàn)的問(wèn)題?4. 我何時(shí)應(yīng)該在Java中使用JFrame.add(component)和JFrame.getContentPane()。add(component)5. phpstudy8.1沒(méi)集成mysql-front6. docker - 如何修改運(yùn)行中容器的配置7. 關(guān)于docker下的nginx壓力測(cè)試8. html5和Flash對(duì)抗是什么情況?9. 利用IPMI遠(yuǎn)程安裝centos報(bào)錯(cuò)!10. docker-machine添加一個(gè)已有的docker主機(jī)問(wèn)題

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