更改点击时的 v-navigation-drawer 内容

huangapple go评论69阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年2月17日 23:37:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75486330.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定