V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
juventusryp
V2EX  ›  问与答

求解一个 vuetify dialog 传参的问题

  •  
  •   juventusryp · Aug 7, 2020 · 1145 views
    This topic created in 2098 days ago, the information mentioned may be changed or developed.

    现在项目中有一个 v-btn 点击后会弹出一个 v-dialog,在 v-dialog 中输入一些数据会提交。

    每个 v-btn 会有一个对应的数据 id,求解如何把这个 id 一起随着 v-dialog 中的数据提交?

    相关代码如下

    <template v-slot:item="props">
    	// 这里可以通过 props.item.id 取到对应数据的 id,但是不知道具体该怎么写才能传递给 dialog,再从 dialog 的 submit 提交
    	<v-btn @click.stop="butter">
            <v-icon>add</v-icon>
        </v-btn>
    </template>
    
    // 弹出的 dialog
    <v-dialog
          v-model="dialog"
          max-width="290"
        >
        <v-card>
            <v-form>
            <v-card-text>
              <v-container> 
                <v-row>
                  <v-col cols="12">
                    <v-text-field label="数量" v-model="butterCount"></v-text-field>
                  </v-col>
                </v-row>
                
              </v-container>
            </v-card-text>
            <v-card-actions>
              <v-spacer></v-spacer>
              <v-btn color="blue darken-1" text @click="dialog = false">取消</v-btn>
              <v-btn color="blue darken-1" text @click="submit">确认</v-btn>
            </v-card-actions>
            </v-form>
          </v-card>
        </v-dialog>
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5755 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 08:38 · PVG 16:38 · LAX 01:38 · JFK 04:38
    ♥ Do have faith in what you're doing.