找回密码
 立即注册

QQ登录

只需一步,快速开始

Lenka.Guo 讲师达人认证 悬赏达人认证
超级版主   /  发表于:2020-11-17 16:50  /   查看:2396  /  回复:0
本帖最后由 Lenka.Guo 于 2020-11-19 21:17 编辑

ActiveReportsJS Web 设计器与 Vue 框架 集成
创建 Vue应用
创建 Vue 应用的最简单的方法是使用Vue CLI
vue create arjs-designer-app
安装 ActiveReportsJS 相关文件
Web 报表设计器功能是@grapecity/activereports npm 包中的一个功能模块。在使用 ActiveReportsJS 时,可以执行以下命令来安装在应用根目录下:
  1. npm install @grapecity/activereports@beta
复制代码

或者使用yarn命令
  1. yarn add @grapecity/activereports
复制代码


1. 添加 Designer的宿主元素
在 src\components 文件夹,添加 DesignerHost.vue 文件并插入以下代码
  1. <template>
  2.   <div id="designer-host"></div>
  3. </template>

  4. <script>
  5. import { Designer as ReportDesigner } from "@grapecity/activereports/reportdesigner";
  6. export default {
  7.   name: "DesignerHost",
  8.   mounted: function() {
  9.     new ReportDesigner("#designer-host");
  10.   },
  11. };
  12. </script>

  13. <style scoped>
  14. #designer-host {
  15.   margin: 0 auto;
  16.   width: 100%;
  17.   height: 100vh;
  18. }
  19. </style>
复制代码


以上代码是初始化报表设计器示例,需要注意的是宿主元素ID 一定要可用。
2. 在应用程序中添加 DesignerHost 功能
修改src\App.vue 文件的 template 及 script 部分,如下:
  1. <template>
  2.   <div id="app">
  3.     <DesignerHost />
  4.   </div>
  5. </template>

  6. <script>
  7. import DesignerHost from "./components/DesignerHost.vue";

  8. export default {
  9.   name: "App",
  10.   components: {
  11.     DesignerHost,
  12.   },
  13. };
  14. </script>
  15. ```

  16. Import required styles to `src\main.js`

  17. ```javascript
  18. import "@grapecity/activereports/styles/ar-js-ui.css";
  19. import "@grapecity/activereports/styles/ar-js-designer.css";
复制代码






运行项目
使用 yarn serve 命令运行应用。 ActiveReportsJS 设计器控件就会出现在页面中,可以做一些基本的控件添加,修改,数据绑定等操作来测试设计器的功能。



1 个回复

倒序浏览
您需要登录后才可以回帖 登录 | 立即注册
返回顶部