【发布时间】:2017-06-28 09:30:58
【问题描述】:
<template>
<div id="app" class="phone-viewport">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<router-view></router-view>
<bottomBar v-bind:visibles='show' ></bottomBar>
</div>
</template>
<script>
export default {
name: '',
show: '',
data () {
return {
visibles: [
{name: 'Football', show: true},
{name: 'Basketball', show: true},
{name: 'Hockey', show: true},
{name: 'VolleyBall', show: false},
{name: 'Baseball', show: false},
]
}
}
}
</script>
我希望在 VolleyBall 和 Beisbol 上隐藏 bottomBar。 但我总是有这个错误“属性或方法“显示”没有在实例上定义,但在渲染期间被引用。确保在数据选项中声明反应数据属性。 "
<script>
export default {
name: 'app',
data () {
return {}
},
computed: {
hideBottom: function () {
if (this.$router.path === '/baseball' || this.$router.path === '/volleyball') return false
else { return true }
}
}
}
【问题讨论】:
-
它对您有帮助还是来自其他人的支持?
标签: vue.js vuejs2 vue-component vue-router