删除 操作

 <el-button type="danger" size="mini" icon="el-icon-delete" @click="removeById(scope.row.goods_id)"></el-button>
 
 // 删除
        async removeById(goods_id){
              const confirmResult = await this.$confirm('此操作将永久删除该商品, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
               }).catch(err => err) 
            // 取消删除操作
            if(confirmResult !== 'confirm'){
                return this.$message.info('已取消删除')
            }
            //删除 
            const {data:res} = await this.$http.delete(`categories/${goods_id}`)
            if(res.meta.status !== 200){
                return this.$message.error('删除失败')
            }
            this.$message.success('删除成功')
            this.getGoodsList()
        }
              
posted @ 2020-06-23 16:06  EricBlog  阅读(210)  评论(0编辑  收藏  举报