代码拉取完成,页面将自动刷新
<Upload
:headers="auths"
:action="userImport"
:show-upload-list="false"
:format="['xls','csv','xlsx']"
:on-success="afterImport">
<Button type="primary" style="background-color: #fff;color:#204DF2;border-color:#204DF2"><icon custom="iconfont icon-shangchuan" style="margin-right:12px"></icon>上传信息</Button>
</Upload>
// 下载数据
export const downLoad = () => {
return axios.request({
url: '/api/user/download',
method: 'get',
responseType: 'blob' // 这个是必须的
})
}
在 data赋值后添加
this.data.forEach(item => {
item._checked = this.checkList.some(it => it.id == item.id)
})
// 点击分页进入时判断当前数据是否已勾选 勾选的显示勾选
table 点击事件 on-selection-change 方法中添加
Select (sel) {
this.checkList = this.checkList.filter(item => !this.data.some(it => it.id == item.id)) // 过滤掉id没有选中的数据
this.checkList.push(...sel) // 选中数组合并到选中列表中
},
复选框中已选中数据禁止点击
if(item.is_exit ){
obj['_disabled'] = true
} else{
obj['_disabled'] = false
}
return obj // 遍历数据中的每个元素,每个元素已经使用过的_disabled为true 否则为false
<Table border :columns="columns12" :data="data6">
<template slot-scope="{ row }" slot="name">
<strong>{{ row.name }}</strong>
</template>
<template slot-scope="{ row, index }" slot="action">
<Button type="primary" size="small" style="margin-right: 5px" @click="show(index)">View</Button>
<Button type="error" size="small" @click="remove(index)">Delete</Button>
</template>
</Table>
js中内容
columns12: [
{
title: 'Name',
slot: 'name'
},
{
title: 'Age',
key: 'age'
},
{
title: 'Address',
key: 'address'
},
{
title: 'Action',
slot: 'action',
width: 150,
align: 'center'
}
],
源码:https://gitee.com/Mandy_wang/iview-test/tree/master/src/views/institutions
<span @click="loadMore" v-if="isShowAll" class="btn">
加载更多
<Icon type="md-arrow-round-down" class="icon" />
</span>
<!--isShowAll: false, // 判断是否已显示完所有的数据-->
loadMore() {
this.switchList = true // switchList:false,//是否加载更多
this.pageNum += 1
this.showNext()
},
// 删除时 this.switchList = false
showNext () {
let list = []
let params = {
page:this.pageNum,
page_size: this.pageSize,
}
getDatalist(params).then(res=>{
list = res.data
if (this.switchList) {
// 加载更多时
this.son.push(...list)
} else {
this.son = list
}
if (this.son.length < res.data.data.total) { // 判断当前数据小于总数时
this.isShowAll = true // 继续显示加载按钮
} else {
this.isShowAll = false // 不显示加载按钮
}
})
},
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。