当前位置: 首页 > news >正文

工业和信息化网站备案系统中国建设银官方网站

工业和信息化网站备案系统,中国建设银官方网站,wdlinux 默认网站,做网站江门and design vue2版的table表格不能拖拽列的宽度,通过vue-draggable-resizable插件实现 我用的是and design 1.7.8的版本,先下插件 yarn add vue-draggable-resizable2.1.0我这版本的and design用最新3.0.0以上的插件会有问题,实现不了效果&a…

and design vue2版的table表格不能拖拽列的宽度,通过vue-draggable-resizable插件实现
我用的是and design 1.7.8的版本,先下插件

yarn add vue-draggable-resizable@2.1.0

我这版本的and design用最新3.0.0以上的插件会有问题,实现不了效果,换了低版本就没问题了
官方也有教使用方法,但会报错,按照官方的来写,需要把ResizeableTitle改成resizeableTitle这样就解决了最开始的报错
在这里插入图片描述
官方使用地址
下面是我封装的table公用组件,但是这样弄问题很多,在表格里加一下操作的时候很容易有问题,所以谨慎用这玩意

<template><div class="tableCommon-wrapper"><a-tablev-if="istrue":expandIconColumnIndex="expandIconColumnIndex" :expandIconAsCell="expandIconAsCell":defaultExpandAllRows="defaultExpandAllRows" :columns="columns" :dataSource="data" :loading="loading":indentSize="indentSize" :pagination="pagination" :row-selection="rowSelection":childrenColumnName="childrenColumnName" size="middle" :customHeaderRow="tableHeader" @change="handleTableChange":rowKey="rowkey" :scroll="scroll" :bordered="bordered" :hideDefaultSelections="hideDefaultSelections":components="components"><template slot-scope="text, record, index" :slot="slot"v-for="slot in Object.keys($scopedSlots).filter(key => key !== 'expandedRowRender')"><slot :name="slot" v-bind="{ text, record, index }"></slot></template></a-table></div>
</template><script>
import Vue from "vue";
import VueDraggableResizable from "vue-draggable-resizable";
Vue.component("vue-draggable-resizable", VueDraggableResizable);export default {name: 'ttable',props: {childrenColumnName: {type: String},rowkey: {type: String},tableHead: {type: Array,required: true},tableData: {type: Array,required: true},loading: {type: Boolean,default: false},indentSize: {// eslint-disable-next-line vue/require-prop-type-constructortype: Boolean | Number},pagination: {// eslint-disable-next-line vue/require-prop-type-constructortype: Boolean | Object},rowSelection: {type: Object},scroll: {type: Object,// default:()=> ({x: 1200, y: 600}) ,},expandIconAsCell: {type: Boolean},expandIconColumnIndex: {type: Number},size: {// eslint-disable-next-line vue/require-prop-type-constructortype: String | Number},bordered: {type: Boolean,default: true},defaultExpandAllRows: {type: Boolean,default: false},hideDefaultSelections: {type: Boolean,default: false}},data() {return {data:[],columns:[],istrue:false,}},watch:{tableHead(newdata){console.log('表格头部',newdata)this.columns = JSON.parse(JSON.stringify(newdata));},tableData(newdata){console.log('表格数据',newdata)this.data = JSON.parse(JSON.stringify(newdata));}},mounted(){this.init()},methods: {init(){console.log('阿里嘎多',this.tableHead)const draggingMap = {};this.columns = JSON.parse(JSON.stringify(this.tableHead));// this.columns = columns;this.data = JSON.parse(JSON.stringify(this.tableData));this.columns.forEach(col => {draggingMap[col.key] = col.width;});const draggingState = Vue.observable(draggingMap);const that = this;this.components = {header: {cell: (h, props, children) => {let thDom = null;const { key, ...restProps } = props;const col = that.columns.find(col => {const k = col.dataIndex || col.key;return k === key;});if (!col.width) {return <th {...restProps}>{children}</th>;}const onDrag = (x, y) => {draggingState[key] = 0;col.width = Math.max(x, 1);};const onDragstop = () => {draggingState[key] = thDom.getBoundingClientRect().width;};return (<th{...restProps}v-ant-ref={r => (thDom = r)}width={col.width}class="resize-table-th">{children}<vue-draggable-resizablekey={col.key}class="table-draggable-handle"w={10}x={draggingState[key] || col.width}z={1}axis="x"draggable={true}resizable={false}onDragging={onDrag}onDragstop={onDragstop}/></th>);}}};this.istrue=true;console.log('来阿拉啦啦啦',this.components)},tableHeader(column) {// console.log("column",column);column.forEach((e, index) => {column[index].className = 'table-thead';});},handleTableChange(val) {console.log("valllsadlalsdlsa:",val);this.$emit('changeCurrent', val.current);}}
}
</script><style lang='scss'>
.resize-table-th {position: relative;.table-draggable-handle {height: 100% !important;bottom: 0;left: auto !important;right: -5px;cursor: col-resize;touch-action: none;}
}::v-deep .ant-table-thead>tr>th {background: #f6f6f6;height: 50px;font-family: PingFang SC-Medium, PingFang SC;
}::v-deep .ant-table-tbody {background-color: #ffffff;
}::v-deep .ant-table-header-column .ant-table-column-title {font-size: 15px;font-weight: bold;font-family: Microsoft YaHei-Bold, Microsoft YaHei;color: #333333;
}
</style>
http://www.yayakq.cn/news/203223/

相关文章:

  • 网站建设费科目上海官网建设费用
  • 爱做的小说网站吗义乌电商培训班一般多少钱
  • 洛阳青峰网络公司网站建设企业管理制度标准范本
  • 网站建设属于服务还是货物搜索引擎有哪些平台
  • 网站建设解说词做网站建设有前途那
  • 专业手机网站有哪些网站开发验收
  • 可信网站图标企业网站栏目设置说明
  • 怎么在网站上做旅游推广叫别人建个网站多少钱
  • 百度注册网站怎么弄郑州网站建设乙汉狮网络
  • 网站建设对企业的发展杭州网站建设很 棒
  • 公司的网站 优帮云这是我做的网站
  • 网站静态生成目录 名称 建议肇庆seo推广公司
  • 家居全屋定制网站优化简历模板
  • 网站seo优化排名wordpress 新建文章
  • 重庆网站建设案例如何申请网址域名
  • 官方网站建设的方法有哪些方面做网站 (公司)
  • 巴中免费网站建设临邑县住房和城乡建设局网站
  • 南昌企业免费建站视频网站的链接怎么做的
  • 乐辰科技网站建设东莞免费公司网站建设
  • 建设网站用图片需要版权哪里做网站比较快
  • 有建设银行信用卡怎么登陆不了网站网站建设金网科技
  • 建设网站制作汉狮团队网站开发需要什么资质
  • 如何用wordpress修改模板的内容广州网站营销优化开发
  • 做网站教程济南品牌网站建设低价
  • 天津房价WordPress搜索优化工具
  • 济南建站公司注意什么网站文件app
  • 一流的网站建设公司百度官网网站登录
  • 深圳市建网站公广州seo公司如何
  • 网站栏目建设android移动开发
  • 建设目标网站wordpress模板文件夹