vue+element中,根據狀態的不同,顯示不同的操作按鈕


原型效果:

 

 代碼實現:

 <el-table-column property="address" label="操作">
            <template slot-scope="scope">
              <el-button
                @click="setGrade(scope.row)"
                type="text"
                size="small"
                >等級設置</el-button
              >
              <el-button
                @click="evaluationResult(scope.row)"
                type="text"
                size="small"
                >等級評價結果</el-button
              >
              <el-button
                @click="handleClick(scope.row)"
                type="text"
                size="small"
                >修改</el-button
              >
              <el-button
              v-if="scope.row.module == '啟用中'"
                @click="handleClick(scope.row)"
                type="text"
                size="small"
                >停用</el-button
              >
              <el-button
              v-if="scope.row.module === '已停用'"
                @click="handleClick(scope.row)"
                type="text"
                size="small"
                >啟用</el-button
              >
              <el-button
                @click="handleClick(scope.row)"
                type="text"
                size="small"
                >刪除</el-button
              >
            </template>
          </el-table-column>

通過 v-if指令 決定按鈕的顯示隱藏。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM