vue & table with operation slot
vue & table with operation slot
seed demo
<!-- @format -->
<template>
<seed ref="list" :fetch-list="fetchList" :seed="seed">
<template slot="column-joinNum" slot-scope="{ row }">
<el-button
@click="showHistory('join', row)"
:disabled="row.joinNum === 0"
type="text"
>{{ row.joinNum }}</el-button
>
</template>
<template slot="column-violationNum" slot-scope="{ row }">
<el-button
@click="showHistory('violation', row)"
:disabled="row.violationNum === 0"
type="text"
>{{ row.violationNum }}</el-button
>
</template>
<template slot="column-control" slot-scope="{ row }">
<el-button size="mini" @click="reject(row.id)" type="danger"
>驳 回</el-button
>
</template>
</seed>
</template>
<script>
/**
* 正常用户
*/
import axios from 'axios'
import JoinHistory from './JoinHistory'
import ViolationHistory from './ViolationHistory'
import { SelectBox } from '@/mixins/audit'
const REJECT_REASONS = [
'发布营销内容',
'发布与事实不符内容',
'发布辱骂内容',
'发布不符合社区制度内容',
'发布违法内容'
]
export default {
components: {
JoinHistory,
ViolationHistory
},
data() {
return {
seed: [
{
key: 'userId',
label: '用户ID',
readonly: true
},
{
key: 'userName',
label: '用户名称',
readonly: true
},
{
key: 'mobileNo',
label: '用户手机号',
readonly: true
},
{
key: 'feedNum',
label: '内容数',
readonly: true
},
{
key: 'qualityFeedNum',
label: '优质内容数',
},
{
label: '最新加入时间',
key: 'addTime',
type: 'time',
},
{
key: 'joinNum',
label: '加入次数',
},
{
key: 'violationNum',
label: '违规次数',
}
]
}
},
methods: {
fetchList(params) {
return axios('/opapi/tweetClub', {
params: {
...params,
status: 1
}
})
},
showHistory(type = 'join', row = {}) {
const h = this.$createElement
let { userId, userName } = row
this.$msgbox({
title: userName + '的' + (type === 'join' ? '加入' : '违规') + '记录',
message: h(type + '-history', {
key: userId,
props: {
userId
}
})
})
},
reject(id) {
if (!id) {
this.$message.error('没有ID')
return
}
SelectBox(
REJECT_REASONS,
'是否驳回该用户身份,驳回后该用户将不享受福利!'
)
.then(supplement => {
return axios.put(`/opapi/tweetClub/${id}/reject`, '', {
params: {
supplement
}
})
})
.then(() => {
this.$message({
message: '驳回成功',
type: 'success',
})
this.$nextTick(() => {
this.$refs.list.refresh()
})
})
.catch(e => {
let message = e.message || e
if (e.response) {
message = e.response.data
}
this.$message.error(message)
})
}
}
}
</script>
refs
seed
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
vue & table with operation slot的更多相关文章
- vue table中使用多选的问题(翻页后如何保存已选项),联动echarts图表实现流量监控
流量监控项目需求: 根据表格数据,添加多选功能,默认全选,根据已选项更新图表视图 1.表格需要多选 2.要联动图表,所以关键是要利用表格多选的触发回调函数 vue table中使用多选: 很简单,只需 ...
- Vue学习笔记:Slot
转自:https://www.w3cplus.com/vue/vue-slot.html 在Vue中,slot也分多种,从Vue的官网中可以获知,其主要分为:单个插槽.具名插槽和作用域插槽三种 父组件 ...
- vue.js中的slot
vue.js 中的 slot 一.slot 的作用 调用组件的时候,对于数据,我们会用props将数据从父组件传至子组件.但是,如果从父组件到子组件,单纯是页面局部渲染的改变,slot会更合适. 二. ...
- vue table已选列数据
vue Table@on-selection-change="test" 已选中项数据 test(selection){} <Table :data="tableD ...
- 第八十九篇:Vue 重学插槽slot
好家伙, 1.什么是插槽? 插槽是vue为组件的封装者提供的能力.允许开发者在封装组件时, 把不确定的,希望由用户指定的部分定义为插槽 我们依然可以把它理解为一个占位符 1.1.插槽的基本用法 试 ...
- vue table 固定首列和首行
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name ...
- [Vue]组件——插槽:slot(匿名插槽,具名插槽)与slot-scope(作用域插槽)
1.单个插槽 | 匿名插槽 1.1<navigation-link> 子组件定义为: <a v-bind:href="url" class="nav-l ...
- 在vue中使用插槽 slot
插槽(slot)这个概念非常重要 插槽的使用场景1:在子组件里面显示父组件的dom <div id='root'> <child content = '<p>Dell&l ...
- vue中的插槽slot理解
本篇文章参考赛冷思的个人博客 1.函数默认传参 在我们写js函数我们的可能会给他们一个默认的参数,写法是 function show(age,name){ var age = age || 20; v ...
随机推荐
- Springboot中PropertySource注解的使用
https://blog.csdn.net/qq_30739519/article/list/3 注解 https://blog.csdn.net/qq_30739519/article/detail ...
- DP 从棺材到入土
区间DP P1063 能量项链 题目描述 给定一串首尾相连的能量珠串 按照该计算规则进行合并:如果前一颗能量珠的头标记为\(m\),尾标记为\(r\),后一颗能量珠的头标记为\(r\),尾标记为\(n ...
- Docker私服搭建--Harbor
Docker私服搭建--Harbor Harbor概述 Harbor的安全机制 Harbor的镜像同步 Harbor的镜像同步机制 Harbor的多级部署 一.安装 1.1 docker安装 1.2 ...
- Django(命名空间)
命名空间 命名空间(英语:Namespace)是表示标识符的可见范围.一个标识符可在多个命名空间中定义,它在不同命名空间中的含义是互不相干的.这样,在一个新的命名空间中可定义任何标识符,它们不会与任何 ...
- 1.DHCP的定义
1.Dynamic Host Configuration Protocol (DHCP)是一种客户端/服务器协议,可自动向Internet协议(IP)主机提供其IP地址和其他相关配置信息,例如子网掩码 ...
- 从零搭建一个IdentityServer——聊聊Asp.net core中的身份验证与授权
OpenIDConnect是一个身份验证服务,而Oauth2.0是一个授权框架,在前面几篇文章里通过IdentityServer4实现了基于Oauth2.0的客户端证书(Client_Credenti ...
- SpringBoot - 实现文件上传2(多文件上传、常用上传参数配置)
在前文中我介绍了 Spring Boot 项目如何实现单文件上传,而多文件上传逻辑和单文件上传基本一致,下面通过样例进行演示. 多文件上传 1,代码编写 1)首先在 static 目录中创建一个 up ...
- 敏捷史话(五):敏捷已逝 —— Dave Thomas
" 敏捷已逝,但敏捷精神长存.因为所谓的敏捷专家卖给你的是方法论,而不是价值."当多数人都在从"敏捷"身上榨取利益时, Dave Thomas 成为了一位逆行者 ...
- Spring MVC 处理一个请求的流程分析
Spring MVC是Spring系列框架中使用频率最高的部分.不管是Spring Boot还是传统的Spring项目,只要是Web项目都会使用到Spring MVC部分.因此程序员一定要熟练掌握MV ...
- [CF套题] CF-1201
CF-1201 传送门 # = * A 500 B 1000 C 1500 D 2000 E1 2000 E2 1000 1 (2217) 1672 482 00:09 400 01:40 790 0 ...