Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

利用迴圈產生的元件中,index不會隨著迴圈改變值 #89

Open
LamCaleter opened this issue Dec 3, 2020 · 1 comment
Open

Comments

@LamCaleter
Copy link

問題

利用迴圈產生的元件中,index 不會隨著迴圈改變值。

##簡單重現程式碼 :

        <v-contextmenu ref="contextmenu" v-on:contextmenu="handleContextmenu">
            <v-contextmenu-item v-on:click="AddField(index)">{{index}}</v-contextmenu-item>
        </v-contextmenu>

期望结果

文字 [右鍵文字內容] (事件)

1 [1] (AddField(1))
2 [2] (AddField(2))
.....
.....
10 [10] (AddField(10))

实际结果

此時 Contextmenu 的 Index 永遠為1

文字 [右鍵文字內容] (事件)

1 [1] (AddField(1))
2 [1] (AddField(1))
.....
.....
10 [1] (AddField(1))

环境说明

  • 组件版本:2.8.1
  • Vue 版本: 2.6.11
  • 操作系统及版本:WINDOWS10
  • 浏览器及版本: CHROME 87
@yvywang
Copy link

yvywang commented Dec 10, 2021

ref固定,命中的永远只会是第一个,你或许需要动态绑定ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants