在线表格编辑器(@grapecity-software/spread-sheets-designer-vue)

https://www.grapecity.com.cn/developer/spreadjs

App.vue:

javascript 复制代码
<script>
import '@grapecity-software/spread-sheets/styles/gc.spread.sheets.excel2013white.css';
import "@grapecity-software/spread-sheets-designer/styles/gc.spread.sheets.designer.min.css";
import * as GC from "@grapecity-software/spread-sheets";
import "@grapecity-software/spread-sheets-print";
import "@grapecity-software/spread-sheets-shapes";
import "@grapecity-software/spread-sheets-slicers";
import "@grapecity-software/spread-sheets-pivot-addon";
import "@grapecity-software/spread-sheets-tablesheet";
import "@grapecity-software/spread-sheets-ganttsheet";
import "@grapecity-software/spread-sheets-reportsheet-addon";
import "@grapecity-software/spread-sheets-formula-panel";
import "@grapecity-software/spread-sheets-io";
import '@grapecity-software/spread-sheets-resources-zh';
GC.Spread.Common.CultureManager.culture("zh-cn");
import '@grapecity-software/spread-sheets-designer-resources-cn';
import "@grapecity-software/spread-sheets-designer";
import MyDesigner from "@grapecity-software/spread-sheets-designer-vue"

export default {
  name: "App",
  data: function () {
    var config = GC.Spread.Sheets.Designer.DefaultConfig;
    config.commandMap = {
      Welcome: {
        title: "Welcome",
        text: "Welcome",
        iconClass: "ribbon-button-welcome",
        bigButton: "true",
        commandName: "Welcome",
        execute: async (context, propertyName, fontItalicChecked) => {
          alert("Welcome to new designer.");
        },
      },
    };
    config.ribbon[0].buttonGroups.unshift({
      label: "NewDesigner",
      thumbnailClass: "welcome",
      commandGroup: {
        children: [
          {
            direction: "vertical",
            commands: ["Welcome"],
          },
          // This is custom button ----------------end-------------
        ],
      },
    });
    return {
      styleInfo: { height: "98vh", width: "100%" },
      config: config,
      spreadOptions: {
        sheetCount: 2,
      },
      designer: null,
    };
  },
  components: {
    MyDesigner,
  },
  methods: {
    designerInitialized(value) {
      this.designer = value;
    },
  },
};
</script>

<template>
  <div id="gc-designer-container">
    <MyDesigner
      :styleInfo="styleInfo"
      :config="config"
      :spreadOptions="spreadOptions"
      @designerInitialized="designerInitialized"/>
  </div>
</template>

<style>
.ribbon-button-welcome {
    background-image: url('./assets/welcome.png');
    background-size: 35px 35px;
}
</style>

main.ts:

javascript 复制代码
import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'

const app = createApp(App)

app.use(createPinia())
app.use(router)


app.mount('#app')

package.json:

javascript 复制代码
{
  "name": "m-spread",
  "version": "0.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "run-p type-check \"build-only {@}\" --",
    "build1": "node --max-old-space-size=8096 ./node_modules/vite/bin/vite.js build",
    "preview": "vite preview",
    "build-only": "vite build",
    "type-check": "vue-tsc --build --force",
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
  },
  "dependencies": {
    "@grapecity-software/spread-excelio": "17.0.2",
    "@grapecity-software/spread-sheets": "17.0.2",
    "@grapecity-software/spread-sheets-barcode": "17.0.2",
    "@grapecity-software/spread-sheets-charts": "17.0.2",
    "@grapecity-software/spread-sheets-designer": "17.0.2",
    "@grapecity-software/spread-sheets-designer-resources-cn": "17.0.2",
    "@grapecity-software/spread-sheets-designer-vue": "17.0.2",
    "@grapecity-software/spread-sheets-formula-panel": "17.0.2",
    "@grapecity-software/spread-sheets-ganttsheet": "17.0.2",
    "@grapecity-software/spread-sheets-io": "17.0.2",
    "@grapecity-software/spread-sheets-languagepackages": "17.0.2",
    "@grapecity-software/spread-sheets-pdf": "17.0.2",
    "@grapecity-software/spread-sheets-pivot-addon": "17.0.2",
    "@grapecity-software/spread-sheets-print": "17.0.2",
    "@grapecity-software/spread-sheets-reportsheet-addon": "17.0.2",
    "@grapecity-software/spread-sheets-resources-zh": "17.0.2",
    "@grapecity-software/spread-sheets-shapes": "17.0.2",
    "@grapecity-software/spread-sheets-slicers": "17.0.2",
    "@grapecity-software/spread-sheets-tablesheet": "17.0.2",
    "pinia": "^2.1.7",
    "rollup-plugin-visualizer": "^5.12.0",
    "vue": "^3.4.29",
    "vue-router": "^4.3.3"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.8.0",
    "@tsconfig/node20": "^20.1.4",
    "@types/node": "^20.14.5",
    "@vitejs/plugin-vue": "^5.0.5",
    "@vue/eslint-config-typescript": "^13.0.0",
    "@vue/tsconfig": "^0.5.1",
    "eslint": "^8.57.0",
    "eslint-plugin-vue": "^9.23.0",
    "npm-run-all2": "^6.2.0",
    "typescript": "~5.4.0",
    "vite": "^5.3.1",
    "vite-plugin-vue-devtools": "^7.3.1",
    "vue-tsc": "^2.0.21"
  }
}

编译

yarn build1

打包报告

vite.config.js:

javascript 复制代码
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import { visualizer } from 'rollup-plugin-visualizer'

// https://vitejs.dev/config/
export default defineConfig({
  server: {
    port: 3004
  },
  plugins: [
    vue(),
    vueDevTools(),
    visualizer()
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})

人工智能学习网站

https://chat.xutongbao.top

相关推荐
go2coding6 分钟前
开源 复刻GPT-4o - Moshi;自动定位和解决软件开发中的问题;ComfyUI中使用MimicMotion;自动生成React前端代码
前端·react.js·前端框架
freesharer26 分钟前
Zabbix 配置WEB监控
前端·数据库·zabbix
web前端神器26 分钟前
forever启动后端服务,自带日志如何查看与设置
前端·javascript·vue.js
是Yu欸32 分钟前
【前端实现】在父组件中调用公共子组件:注意事项&逻辑示例 + 将后端数组数据格式转换为前端对象数组形式 + 增加和删除行
前端·vue.js·笔记·ui·vue
weixin_5051544639 分钟前
组件丰富、支持2/3D数据可视化的编辑器平台软件?
3d·信息可视化·编辑器·数字孪生·3d产品配置器·产品交互展示·3d交互设计工具
今天是 几 号42 分钟前
WEB攻防-XSS跨站&反射型&存储型&DOM型&标签闭合&输入输出&JS代码解析
前端·javascript·xss
A-超1 小时前
html5 video去除边框
前端·html·html5
进击的阿三姐1 小时前
vue2项目迁移vue3与gogocode的使用
前端·javascript·vue.js
hawk2014bj2 小时前
React 打包时如何关闭源代码混淆
前端·react.js·前端框架
不会倒的鸡蛋2 小时前
网络爬虫详解
前端·chrome·python