zoukankan      html  css  js  c++  java
  • vue 用mixin写一个删除事件

    src/layout/mixin/delRow.js

     1 export default function(config) {
     2   const { url = '' } = config
     3   return {
     4     methods: {
     5     // 删除
     6       delRow(id) {
     7         this.$confirm('是否删除该信息?', '提示', {
     8           confirmButtonText: '确定',
     9           cancelButtonText: '取消',
    10           type: 'warning'
    11         }).then(() => {
    12           url(id).then(res => {
    13             if (res.code === 20000) {
    14               this.$message({
    15                 showClose: true,
    16                 message: res.message,
    17                 type: 'success'
    18               })
    19               this.queryListByPage()
    20             }
    21           })
    22         }).catch(() => {
    23           this.$message({
    24             type: 'info',
    25             message: '已取消删除'
    26           })
    27         })
    28       }
    29     }
    30   }
    31 }

    <template v-slot="scope">
              <el-button
                type="text"
                @click="delRow(scope.row.lngparamid)"
              >删除</el-button>
            </template>
          </el-table-column>
     
     
    
    
    <script>
    z import DelRow from '@/layout/mixin/delRow'
    2 const delRowMixin = new DelRow({ url: delData })
    3 export default {
    4   name: 'ExtendedFieldSettingTableArea',
    5   mixins: [calculateCommonTableHeight, delRowMixin],
    6 }
    </script>
  • 相关阅读:
    leetcode131分割回文串
    leetcode315 计算右侧小于当前元素的个数
    Tensorflow写代码流程&反向传播
    vue脚手架的搭建
    Vue 脱坑记
    简历中的工作经历要怎么写?
    如何制作高水平简历?
    window.location.hash的知识点
    前端面试题小集
    前端面试题
  • 原文地址:https://www.cnblogs.com/hellofangfang/p/13590481.html
Copyright © 2011-2022 走看看