报错信息:
main.js
- import { createApp } from "vue";
- import { createPinia } from "pinia";
- import ElementPlus from "element-plus";
- import "element-plus/dist/index.css";
- import App from "./App.vue";
- import router from "./router";
- // import {
- // GcSpreadSheets,
- // GcWorksheet,
- // GcColumn,
- // } from "@grapecity/spread-sheets-vue";
- import Designer from "@grapecity/spread-sheets-designer-vue";
- // import "@/style/normalize.css";
- import "virtual:windi.css";
- const app = createApp(App);
- app.component("gc-spread-sheets-designer", Designer);
- // app.component("gc-spread-sheets", GcSpreadSheets);
- // app.component("gc-worksheet", GcWorksheet);
- // app.component("gc-column", GcColumn);
- app.use(ElementPlus);
- app.use(createPinia());
- app.use(router);
- app.mount("#app");
复制代码
// VueDesigner.vue
- <template>
- <div id="gc-designer-container">
- <gc-spread-sheets-designer
- :styleInfo="styleInfo"
- :spreadOptions="spreadOptions"
- @designerInitialized="designerInitialized"
- />
- </div>
- </template>
- <script setup>
- import "@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css";
- import "@grapecity/spread-sheets-designer/styles/gc.spread.sheets.designer.min.css";
- import * as GC from "@grapecity/spread-sheets";
- import "@grapecity/spread-sheets-print";
- import "@grapecity/spread-sheets-shapes";
- import "@grapecity/spread-sheets-pivot-addon";
- import "@grapecity/spread-sheets-tablesheet";
- import "@grapecity/spread-sheets-designer-resources-cn";
- import * as GcDesigner from "@grapecity/spread-sheets-designer";
- import { reactive, toRefs } from "vue";
- const data = reactive({
- designer: GcDesigner.Spread.Sheets.Designer.Designer | null,
- spread: GC.Spread.Sheets.Workbook | null,
- });
- const refData = toRefs(data);
- const styleInfo = { height: "98vh" };
- const spreadOptions = { sheetCount: 2 };
- const designerInitialized = (entity) => {
- data.designer = entity || GcDesigner.Spread.Sheets.Designer.Designer;
- let spread = data.designer.getWorkbook(); // GC.Spread.Sheets.Workbook
- let sheet = spread.getActiveSheet();
- sheet.setValue(0, 0, "Grapecity");
- };
- </script>
复制代码
package.json
- "dependencies": {
- "@fortawesome/fontawesome-free": "^6.1.1",
- "@grapecity/spread-excelio": "^15.1.1",
- "@grapecity/spread-sheets": "^15.1.1",
- "@grapecity/spread-sheets-barcode": "^15.1.1",
- "@grapecity/spread-sheets-charts": "^15.1.1",
- "@grapecity/spread-sheets-designer": "^15.1.1",
- "@grapecity/spread-sheets-designer-resources-cn": "^15.1.1",
- "@grapecity/spread-sheets-designer-vue": "^15.1.1",
- "@grapecity/spread-sheets-languagepackages": "^15.1.1",
- "@grapecity/spread-sheets-pdf": "^15.1.1",
- "@grapecity/spread-sheets-pivot-addon": "^15.1.1",
- "@grapecity/spread-sheets-print": "^15.1.1",
- "@grapecity/spread-sheets-resources-zh": "^15.1.0",
- "@grapecity/spread-sheets-shapes": "^15.1.1",
- "@grapecity/spread-sheets-tablesheet": "^15.1.1",
- "@grapecity/spread-sheets-vue": "^15.1.0",
- "axios": "^0.27.2",
- "element-plus": "^2.2.2",
- "pinia": "^2.0.14",
- "vue": "^3.2.36",
- "vue-router": "^4.0.15"
- },
复制代码 |