欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Vue之elementUI下拉菜單dropdown組件中command方法添加額外參數(shù)方式

 更新時(shí)間:2025年06月03日 09:54:55   作者:A-sleep  
這篇文章主要介紹了Vue之elementUI下拉菜單dropdown組件中command方法添加額外參數(shù)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

elementUI下拉菜單dropdown組件中command方法添加額外參數(shù)

在使用dropdown組件的時(shí)候,需要的參數(shù)可能很多,不僅僅是command一個(gè)參數(shù)。

這就需要通過composeValue構(gòu)造一個(gè)結(jié)構(gòu)了

<el-dropdown @command="handleCommand">

<el-dropdown-menu slot="dropdown">

<template v-for="item in items">

     <el-dropdown-item v-for="it in item " :command="composeValue(it,scope.row)"/>

</template>

</el-dropdown-menu>

</el-dropdown>


//方法部分的處理
    handleCommand(command) {
      console.log(command)
    },
    composeValue(item, id) {
      return {
        button: item,
        id: id
      }
    }

打印結(jié)果

  • table中

      <el-table-column label="操作" width="250" fixed="right">
        <template slot-scope="scope">
          <el-button type="success" @click.stop="goPutin(scope.row)"
            >編輯投放列表</el-button
          >
          <el-dropdown
            @command="(command) => handleCommand(command, scope.row)"
          >
            <el-button type="primary"
              >更多菜單<i class="el-icon-arrow-down el-icon--right"></i
            ></el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="remake">備注</el-dropdown-item>
              <el-dropdown-item command="edit">編輯產(chǎn)品</el-dropdown-item>
              <el-dropdown-item command="changeSort">排序</el-dropdown-item>
              <el-dropdown-item command="remove">刪除</el-dropdown-item>
              <el-dropdown-item command="overHz">{{
                scope.row.productCooperation == 1 ? "終止合作" : "恢復(fù)合作"
              }}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>


<script>
    // 更多操作觸發(fā)
    handleCommand(command, row) {
      switch (command) {
        case "remake":
          this.remake(row);
          break;
        case "edit":
          this.edit(row);
          break;
        case "changeSort":
          this.changeSort(row);
          break;
        case "remove":
          this.remove(row);
          break;
        case "overHz":
          this.overHz(row);
          break;
        default:
          break;
      }
    },


    edit(row) {
      this.$nextTick(() => {
        this.productId = row.productId;
        this.goodsType = "edit";
        this.$refs.goodsAdd.dialogVisible = true;
      });
    },
</script>

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue 封裝面包屑組件教程

    vue 封裝面包屑組件教程

    這篇文章主要介紹了vue 封裝面包屑組件教程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-11-11
  • vue中使用echarts以及簡單關(guān)系圖的點(diǎn)擊事件方式

    vue中使用echarts以及簡單關(guān)系圖的點(diǎn)擊事件方式

    這篇文章主要介紹了vue中使用echarts以及簡單關(guān)系圖的點(diǎn)擊事件方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-06-06
  • 利用vue+elementUI實(shí)現(xiàn)部分引入組件的方法詳解

    利用vue+elementUI實(shí)現(xiàn)部分引入組件的方法詳解

    這篇文章主要給大家介紹了關(guān)于利用vue+elementUI實(shí)現(xiàn)部分引入組件的相關(guān)資料,以及介紹了vue引入elementUI報(bào)錯(cuò)的解決方法,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-11-11
  • vue input輸入框關(guān)鍵字篩選檢索列表數(shù)據(jù)展示

    vue input輸入框關(guān)鍵字篩選檢索列表數(shù)據(jù)展示

    這篇文章主要為大家詳細(xì)介紹了vue input輸入框關(guān)鍵字篩選檢索列表數(shù)據(jù)展示,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-05-05
  • vue3使用localStorage實(shí)現(xiàn)登錄注冊(cè)功能實(shí)例

    vue3使用localStorage實(shí)現(xiàn)登錄注冊(cè)功能實(shí)例

    這篇文章主要給大家介紹了關(guān)于vue3使用localStorage實(shí)現(xiàn)登錄注冊(cè)功能的相關(guān)資料, localStorage這個(gè)特性主要是用來作為本地存儲(chǔ)來使用的,解決了cookie存儲(chǔ)空間不足的問題,需要的朋友可以參考下
    2023-06-06
  • Vue中點(diǎn)擊active并第一個(gè)默認(rèn)選中功能的實(shí)現(xiàn)

    Vue中點(diǎn)擊active并第一個(gè)默認(rèn)選中功能的實(shí)現(xiàn)

    這篇文章主要介紹了Vue中點(diǎn)擊active并第一個(gè)默認(rèn)選中功能的實(shí)現(xiàn)代碼,代碼簡單易懂,非常不錯(cuò)具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-02-02
  • Axios學(xué)習(xí)筆記之使用方法教程

    Axios學(xué)習(xí)筆記之使用方法教程

    axios是用來做數(shù)據(jù)交互的插件,最近正在學(xué)習(xí)axios,所以想著整理成筆記方便大家和自己參考學(xué)習(xí),下面這篇文章主要跟大家介紹了關(guān)于Axios使用方法的相關(guān)資料,需要的朋友們下面來一起看看吧。
    2017-07-07
  • vue3使用Electron打包成exe的方法與打包報(bào)錯(cuò)解決

    vue3使用Electron打包成exe的方法與打包報(bào)錯(cuò)解決

    在前端開發(fā)中,Electron是一種常用的工具,它允許開發(fā)者使用Web技術(shù)構(gòu)建桌面應(yīng)用程序,本文主要介紹了vue3使用Electron打包成exe的方法與打包報(bào)錯(cuò)解決,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-06-06
  • Vue?中v-model的完整用法及原理

    Vue?中v-model的完整用法及原理

    本文主要介紹了Vue?中v-model的完整用法及原理,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08
  • Vue通過getAction的finally來最大程度避免影響主數(shù)據(jù)呈現(xiàn)問題

    Vue通過getAction的finally來最大程度避免影響主數(shù)據(jù)呈現(xiàn)問題

    這篇文章主要介紹了Vue通過getAction的finally來最大程度避免影響主數(shù)據(jù)呈現(xiàn),本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-04-04

最新評(píng)論