大神好,本人通过 npm包管理器下载了 ActiveReportsJS,根据文档想要显示报表设计器在页面中,但编译后,提示moment.js错误:
设计器组件的代码如下:
<template lang="">
<div id="host" style="height:100%;width:100%;margin:10px">
<ReportDesigner ref='reportDesigner'></ReportDesigner>
</div>
</template>
<script>
import {ref,onMounted,watch} from 'vue';
import {Designer as ReportDesigner} from '@grapecity/activereports-vue';
//import "@grapecity/activereports-localization/dist/designer/zh-locale";
import "@grapecity/activereports/styles/ar-js-ui.css";
import "@grapecity/activereports/styles/ar-js-designer.css";
export default {
name:'ActiveReportsDesigner',
props:{
reportFile:{
type:String,
default:''
},
reportOrientation:{
type:String,
default:"Landscape"
}
},
components:{ReportDesigner},
setup(props,context){
let reportDesigner = ref();
let resolveFunc = ref(null);
let reportStorage = new Map();
let counter = 0;
onMounted(()=>{
reportDesigner = new ReportDesigner("#host",{language:"zh"});
reportDesigner.setActionHandlers({
onCreate: () => {
const reportId = `NewReport${counter + 1}`;
counter++;
return Promise.resolve({ definition: templates.CPL, id: reportId, displayName: reportId });
},
onOpen: function () {
const ret = new Promise((resolve)=> {
resolveFunc.value = resolve;
return ret;})
},
onSave: (info)=>{
const reportId = info.id || `NewReport${counter + 1}`;
this.reportStorage.set(reportId, info.definition);
counter++;
return Promise.resolve({displayName: reportId});
},
onSaveAs: (info) => {
const reportId = `NewReport${counter + 1}`;
this.reportStorage.set(reportId, info.definition);
counter++;
return Promise.resolve({id: reportId, displayName: reportId });
}
});
})
return {
reportDesigner,
reportStorage,
resolveFunc,
counter,
}
}
}
|