【发布时间】:2018-03-24 21:28:50
【问题描述】:
我希望在我的 Vuejs 代码中的 mounted 生命周期挂钩期间调用我的 hideMe() 函数。目前不是,我不明白为什么。
我的代码如下:
export default {
data() {
return {
show: "initial"
}
},
methods: {
hideMe() {
if(this.$vuetify.breakpoint.name == 'xs') {
console.log("When is this rendered? " + this.$vuetify.breakpoint.name == 'xs');
this.show = "none";
}
}
},
mounted() {
this.hideme();
console.log("This is a breakpoint name " + this.$vuetify.breakpoint.name);
console.log(this.show);
},
computed: {
imageHeight () {
switch (this.$vuetify.breakpoint.name) {
case 'xs': return '450px';
case 'sm': return '500px';
case 'md': return '500px';
case 'lg': return '540px';
case 'xl': return '540px';
}
}
}
};
【问题讨论】:
标签: vue.js vuetify.js