From bb4cd2331463af2a5cec08af75d82321043e23aa Mon Sep 17 00:00:00 2001 From: sakuya <81883387@qq.com> Date: Sat, 28 May 2022 20:23:08 +0800 Subject: [PATCH] =?UTF-8?q?ADD=20scTableColumn=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/scTable/column.js | 23 +++++++++++++++++++++++ src/scui.js | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 src/components/scTable/column.js diff --git a/src/components/scTable/column.js b/src/components/scTable/column.js new file mode 100644 index 00000000..af5ab1fe --- /dev/null +++ b/src/components/scTable/column.js @@ -0,0 +1,23 @@ +import { h, resolveComponent } from 'vue' + +export default { + render() { + return h ( + resolveComponent("el-table-column"), + { + index: this.index, + ...this.$attrs + }, + this.$slots + ) + }, + methods: { + index(index){ + if(this.$attrs.type=="index"){ + let page = this.$parent.$parent.currentPage + let pageSize = this.$parent.$parent.pageSize + return (page - 1) * pageSize + index + 1 + } + } + } +} diff --git a/src/scui.js b/src/scui.js index 99f5b070..c450f853 100644 --- a/src/scui.js +++ b/src/scui.js @@ -5,6 +5,7 @@ import http from "./utils/request" import { permission, rolePermission } from './utils/permission' import scTable from './components/scTable' +import scTableColumn from './components/scTable/column.js' import scFilterBar from './components/scFilterBar' import scUpload from './components/scUpload' import scUploadMultiple from './components/scUpload/multiple' @@ -43,6 +44,7 @@ export default { //注册全局组件 app.component('scTable', scTable); + app.component('scTableColumn', scTableColumn); app.component('scFilterBar', scFilterBar); app.component('scUpload', scUpload); app.component('scUploadMultiple', scUploadMultiple);