在我的应用程序中Vue.JS
,我尝试使用两个框架。出于某种原因,我的下一个代码引发了错误。就我而言,每个侧边栏都在一个单独的组件中。如何解决此类错误?v-navigation-drawer
Vuetify
错误:
vue.esm.js?efeb:628 [Vue 警告]:避免直接改变 prop,因为只要父组件重新渲染,该值就会被覆盖。相反,使用基于道具值的数据或计算属性。正在变异的道具:“开放”
BaseLayout.vue:
<template>
<div>
<v-app-bar app>
<v-btn
icon
@click.stop="openLeftNavigationDrawer=!openLeftNavigationDrawer">
<v-icon>mdi-map-clock-outline</v-icon>
</v-btn>
<v-spacer></v-spacer>
<v-btn
icon
@click.stop="openRightNavigationDrawer=!openRightNavigationDrawer">
<v-icon>mdi-filter</v-icon>
</v-btn>
</v-app-bar>
<left-navigation-drawer
:open="openLeftNavigationDrawer">
</left-navigation-drawer>
<right-navigation-drawer
:open="openRightNavigationDrawer">
</right-navigation-drawer>
<v-content style="padding:unset!important;">
<slot></slot>
</v-content>
</div>
</template>
<script>
import LeftNavigationDrawer from '../elements/LeftNavigationDrawer'
import RightNavigationDrawer from '../elements/RightNavigationDrawer'
export default {
name: 'BaseLayout',
components: {
LeftNavigationDrawer,
RightNavigationDrawer
},
data: function () {
return {
openLeftNavigationDrawer: false,
openRightNavigationDrawer: false
}
}
}
</script>
LeftNavigationDrawer.vue:
<template>
<v-navigation-drawer
v-model="open"
absolute
left>
</v-navigation-drawer>
</template>
<script>
export default {
name: 'LeftNavigationDrawer',
props: {
open: false
}
}
</script>
RightNavigationDrawer.vue:
<template>
<v-navigation-drawer
v-model="open"
absolute
right>
</v-navigation-drawer>
</template>
<script>
export default {
name: 'RightNavigationDrawer',
props: {
open: false
}
}
</script>