英文:
Change v-navigation-drawer content on click
问题
以下是翻译好的部分:
"I have 1 v-navigation-drawer and 2 buttons."
我有一个 v-navigation-drawer 和 2 个按钮。
"The first button opens the 1st drawer, the 2nd button is supposed to change the drawer's content."
第一个按钮打开第一个抽屉,第二个按钮应该更改抽屉的内容。
"What I would like is to be able to change the content of the drawer (once opened), as soon as I click on the button without having it closed. I don't want it to close when its content changes. I would just like its content to change without the 'closing animation'."
我希望能够在打开后,只要我点击按钮就能更改抽屉的内容,而不必将其关闭。我不希望在内容更改时关闭它。我只想更改内容而不要有“关闭动画”。
"The issue I'm facing at the moment is that the content changes (I can see the new text for half a second) but then it closes."
我目前面临的问题是内容会更改(我可以看到新的文本半秒钟),但然后它会关闭。
"Here's what my code looks like :"
这是我的代码的样子:
"..."
"..."
"data() {..."
"data() {..."
"methods: {..."
"methods: {..."
英文:
I have 1 v-navigation-drawer and 2 buttons.
The first button opens the 1st drawer, the 2nd button is supposed to change the drawer's content.
What I would like is to be able to change the content of the drawer (once opened), as soon as I click on the button without having it closed. I don't want it to close when its content changes. I would just like its content to change without the "closing animation".
The issue I'm facing at the moment is that the content changes (I can see the new text for half a second) but then it closes.
Here's what my code looks like :
<template>
<div>
<v-btn @click="drawerTest = !drawerTest">TESTING 1</v-btn><br><br>
<v-btn @click="changeContent">TESTING 2</v-btn>
<v-navigation-drawer
v-model="drawerTest"
height="100vh"
width="360px"
absolute
temporary
hide-overlay
right
>
<p>
{{this.content1}}
</p>
</v-navigation-drawer>
</div>
</template>
data() {
let content1 = "This is the first test";
let content2 = "HELLO";
},
methods: {
changeContent() {
this.content1 = this.content2;
},
}
答案1
得分: 1
你应该移除temporary
属性,而是添加一个stateless
属性。
英文:
You should remove the temporary
prop and instead add a stateless
prop.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论