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

东营黄页企业名录优化搜狗排名

东营黄页企业名录,优化搜狗排名,网站名称设置,太原做网站要多少钱呢效果如图,姓名 数值1 字段进行自动合并 封装合并列js - tableMerge.js // 获取列合并的行数 // params // tableData: 表格数据 // mergeId: 合并的列的字段名 export const tagRowSpan (tableData, mergeId) >{const tagArr [];let pos 0;tableData.map((i…

效果如图,姓名 数值1 字段进行自动合并
上下内容如果相同,则进行合并
封装合并列js - tableMerge.js

// 获取列合并的行数
// params
// tableData: 表格数据
// mergeId: 合并的列的字段名
export const tagRowSpan = (tableData, mergeId) =>{const tagArr = [];let pos = 0;tableData.map((item, index) => {if (index === 0) {tagArr.push(1);pos = 0;} else if (tableData[index][mergeId] === tableData[index - 1][mergeId]) {// 合并项目tagArr[pos] += 1;tagArr.push(0);} else {tagArr.push(1);pos = index;}});return tagArr;
}
// 列方法
export const handleSpanMethod  = ({ rowIndex, columnIndex, column }, tagArr, needMergeCol) => {if (needMergeCol.includes(columnIndex)) {const _row = tagArr[column.property][rowIndex];const _col = _row > 0 ? 1 : 0;return {rowspan: _row,colspan: _col,};}
}

拖拽使用sortablejs

npm install sortablejs -S

使用实例

如果拖拽列 要动态生成列


<template><el-table :data="tableData.data" border style="width: 100%; margin-top: 20px":span-method="(param) => handleSpanMethod(param, tableData.spanMap, needMergeCol)" ref="dragTable" ><el-table-column :prop="col.prop" :label="col.label" v-for="(col, index) in colData" :key="col.prop + index"></el-table-column></el-table>
</template><script>
import Sortable from 'sortablejs'
import { tagRowSpan ,handleSpanMethod} from '@/utils/tableMerge.js'
export default {data () {return {colData: [{prop: 'name',label: '姓名'},{prop: 'id',label: 'ID',width: '180'},{prop: 'amount1',label: '数值 1(元)'},{prop: 'amount2',label: '数值 2(元)'},{prop: 'amount3',label: '数值 3(元)'}],tableData: {data: [{id: '1',name: '王小虎1',amount1: '234',amount2: '3.2',amount3: 10}, {id: '2',name: '王小虎1',amount1: '234',amount2: '4.43',amount3: 12}, {id: '3',name: '王小虎1',amount1: '324',amount2: '1.9',amount3: 9}, {id: '4',name: '王小虎4',amount1: '621',amount2: '2.2',amount3: 17}, {id: '5',name: '王小虎5',amount1: '539',amount2: '4.1',amount3: 15}],mergeField: ['name','amount1'],//存储字段合并的行数spanMap: {},},};},methods: {handleSpanMethod,columnDrop () {const wrapperTr = document.querySelector('.el-table__header-wrapper tr')Sortable.create(wrapperTr, {animation: 180,delay: 0,onEnd: evt => {let value = this.colDataconst oldItem = value[evt.oldIndex]value.splice(evt.oldIndex, 1)value.splice(evt.newIndex, 0, oldItem)}})},init () {this.tableData.mergeField.forEach(item => {this.tableData.spanMap[item] = tagRowSpan(this.tableData.data, item);})}},computed: {needMergeCol () {return this.tableData.mergeField.map(item => {return this.colData.findIndex(col => col.prop === item)})}},mounted () {document.body.ondrop = function (event) {event.preventDefault(); //用于取消事件的默认行为,比如拒绝拖拽元素的默认行为;event.stopPropagation(); //用于阻止事件冒泡,避免出现多重事件响应}this.init()this.$nextTick(() => {this.columnDrop()})},
};
</script>

注意不支持行拖拽

http://www.hengruixuexiao.com/news/34234.html

相关文章:

  • 汕头市做网站广州外贸推广
  • 网站设置在哪无锡营销型网站建站
  • 网站建设备案哪家好2022最新永久地域网名
  • 东莞市住房和城乡建设局网站百度权重划分等级
  • 餐饮网站建设方案推广seo网站
  • wordpress 中文测试数据库整站优化 mail
  • 英文网站字体大小网站百度推广
  • 做视频网站用什么系统买卖链接网站
  • 塘沽网站建设西安危机公关公司
  • 网站建设现在市场大不大拼多多关键词排名查询软件
  • 企业建站模板下载重庆seo整站优化设置
  • 深圳模板网站网页设计成品源代码
  • 网站建设中 什么意思百度seo怎么优化
  • 嘉兴网站建设咨询网站seo设置是什么
  • 网站页面布局分析最近三天的新闻大事简短
  • 视频网站制作费用最近新闻事件
  • 行业门户型网站制作今日郑州头条最新新闻
  • 网站建设服务器 几核互联网产品推广
  • 网站备案注销找哪个部门360网址大全
  • 东莞网站建设设百度云在线登录
  • 阿里巴巴怎么建设网站首页seo搜索优化怎么做
  • 文山网站建设网站搜索优化技巧
  • 网站文件命名规则北京官方seo搜索引擎优化推荐
  • 电影网站如何做seo18款禁用看奶app入口
  • 用Html5做网站发布任务注册app推广的平台
  • 手机网站建设规划书网盘搜索神器
  • 网站开发培训周末班名词解释搜索引擎优化
  • 网站开发开题报告品牌策划方案案例
  • 岳麓区做网站济宁seo推广
  • 做照片书哪个网站好微信朋友圈营销方案