IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> JavaScript知识库 -> VUE 之 Jspreadsheet CE电子表格的使用步骤 -> 正文阅读

[JavaScript知识库]VUE 之 Jspreadsheet CE电子表格的使用步骤

步骤:
下载

 npm install jexcel

组件引入

import jexcel from 'jexcel'
import 'jexcel/dist/jexcel.css'

定义容器

<div>
 <div class="deploy">
     <span>配置列:</span>
     <el-checkbox v-model="checked" @change="checkedChange">宽上下</el-checkbox>
     <el-checkbox v-model="checkeds" @change="checkedChanges">高左右</el-checkbox>
   </div>
   <div id="app" ref="spreadsheet" />
 </div>

定义配置项

data() {
	return {
var options = {
        data: Arr,
        allowToolbar: false,
        minDimensions: [10, 30],
        tableOverflow: true,
        // lazyLoading: true,
        tableWidth: '1678px',
        tableHeight: '560px',
        freezeColumns: 3,
        columns: [
          { type: 'text', title: 'xx(mm)', width: '150px' },
          { type: 'text', title: 'xx(mm)', width: '150px' },
          { type: 'hidden', title: 'xx(mm)', width: '150px' },
          { type: 'hidden', title: 'xx(mm)', width: '150px' },
          { type: 'text', title: 'xx(片)', width: '150px' },
          { type: 'text', title: 'xx(元/㎡)', width: '150px' },
          { type: 'text', title: 'xx', width: '150px' },
          { type: 'text', title: 'xx', width: '170px' },
          { type: 'text', title: 'xx', width: '150px' },
          { type: 'text', title: 'xx', width: '150px' },
          { type: 'text', title: 'xx(㎡)', width: '150px' },
          { type: 'text', title: 'xx(㎡)', width: '150px' }
        ],
        // rowResize: true,
        // columnDrag: true,
        // allowComments: true,
        contextMenu: function(obj, x, y, e) {
          console.log(`----`, obj.options)
          var items = []

          if (y == null) {
          } else {
            // Insert new row
            if (obj.options.allowInsertRow == true) {
              items.push({
                title: '在此前插入行',
                onclick: function() {
                  obj.insertRow(1, parseInt(y), 1)
                }
              })

              items.push({
                title: '在此后插入行',
                onclick: function() {
                  obj.insertRow(1, parseInt(y))
                }
              })
            }

            if (obj.options.allowDeleteRow == true) {
              items.push({
                title: '删除选中行',
                onclick: function() {
                  obj.deleteRow(obj.getSelectedRows().length ? undefined : parseInt(y))
                }
              })
            }
          }
          // Line
          items.push({ type: 'line' })
          // About
          if (obj.options.about) {
            items.push({
              title: '关于',
              onclick: function() {
                alert(obj.options.about)
              }
            })
          }

          return items
        }
      }
}
}

js实例化表格并渲染之容器中

mounted() {
	const spreadsheet = jexcel(this.$refs.spreadsheet, options)
      Object.assign(this, { spreadsheet })
      spreadsheet.refresh()
}

来看效果:
在这里插入图片描述

此表格就是web版excel功能非常强大且变态,感兴趣的可以尝试一下;
官方apiJspreadsheet CE
ps:全英文的,慎入

  JavaScript知识库 最新文章
ES6的相关知识点
react 函数式组件 & react其他一些总结
Vue基础超详细
前端JS也可以连点成线(Vue中运用 AntVG6)
Vue事件处理的基本使用
Vue后台项目的记录 (一)
前后端分离vue跨域,devServer配置proxy代理
TypeScript
初识vuex
vue项目安装包指令收集
上一篇文章      下一篇文章      查看所有文章
加:2021-10-13 11:21:44  更:2021-10-13 11:24:06 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/20 19:08:17-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码