[{"id":"26713f3d-fbf1-4c9c-bdbe-31fb188e7096","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"21c749ac-6a80-4731-ac3b-597990e79038","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"a64d445f-5e12-4939-999f-7ecbd70978c5","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"d9f783e1-612a-4fa7-9408-7f1c821a45fc","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"af5bd81a-b6cd-410b-84b4-9de9c51c3a7d","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"60de5e12-02d9-4fd1-8db5-cb82a6bca160","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"6af12f79-8609-4b30-8be3-d617d0cd7a16","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"86b2a642-0ee8-4605-b04d-e7e0ec019e01","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"aa9c6845-a521-49a8-ba61-f85856865f32","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]}]
Nuxt.js is a Vue-based framework that provides a well-defined structure for your application along with optimizations that make the development process and final application faster. In this tutorial, we build a Nuxt.js application that uses the Report Viewer component to display the output of a simple report.
The easiest way to create a Nuxt.js application is to use the Create Nuxt App tool. Run the following command from the command prompt or terminal to create a Nuxt.js project.
# with npm v6.1+
npm init nuxt-app arjs-nuxtjs-viewer-app
# with npx(included by default with npm v5.2+)
npx create-nuxt-app arjs-nuxtjs-viewer-app
# with yarn
yarn create nuxt-app arjs-nuxtjs-viewer-app
It will ask you several questions and here are answers you could use
Project name: arjs-nuxtjs-viewer-app
Programming language: TypeScript
Package manager: Yarn
UI framework: None
Nuxt.js modules: None
Linting tools: None
Testing framework: None
Rendering mode: Single Page App
Deployment target: Server (Node.js hosting)
Development tools: None
Version control system: None
We distribute the Vue Report Viewer Component via the @grapecity/activereports-vue
NPM package that depends on the @grapecity/activereports
package that includes the core functionality. In addition, using ActiveReportsJS with Vue v2.x requires the @vue/composition-api
and the @nuxtjs/composition-api
packages.
To install the current version of these packages, run the following command from the application's root folder.
# with npm
npm i @grapecity/activereports-vue @vue/composition-api @nuxtjs/composition-api
# with yarn
yarn add @grapecity/activereports-vue @vue/composition-api @nuxtjs/composition-api
Open the nuxt.config.js
file located in the root folder of the application and add the '@nuxtjs/composition-api/module' string into the buildModules
array so it looks like below
buildModules: [
// https://go.nuxtjs.dev/typescript
'@nuxt/typescript-build',
'@nuxtjs/composition-api/module'
],
ActiveReportsJS uses the JSON format and the rdlx-json
extension for report template files. In the application's static
folder, create a new file called report.rdlx-json
and insert the following JSON content into it.
{
"Name": "Report",
"Body": {
"ReportItems": [
{
"Type": "textbox",
"Name": "TextBox1",
"Value": "Hello, ActiveReportsJS Viewer",
"Style": {
"FontSize": "18pt"
},
"Width": "8.5in",
"Height": "0.5in"
}
]
}
}
Open the pages\index.vue
file and replace the default content with the following code. It integrates the Vue Report Viewer to display the report template that you added on the previous step. It also imports the default Report Viewer Component Styles and defines the style for the viewer's hosting element.
<template>
<div id="viewer-host" >
<Viewer v-bind:report="{ Uri: 'report.rdlx-json' }" />
</div>
</template>
<script lang="ts">
import Vue from "vue";
import {PdfExport} from '@grapecity/activereports';
import {Viewer} from '@grapecity/activereports-vue';
const pdf = PdfExport;
export default Vue.extend({
name: "IndexPage",
components: {
Viewer
},
});
</script>
<style
src="../node_modules/@grapecity/activereports/styles/ar-js-ui.css"
></style>
<style
src="../node_modules/@grapecity/activereports/styles/ar-js-viewer.css"
></style>
<style scoped>
#viewer-host {
height: 100vh;
width: 100%;
}
</style>
You can run the application by using the yarn dev
command. By default, the project runs on http://localhost:3000/
. If you browse this URL, the ActiveReportsJS Report Viewer
will appear on the page. The viewer will display the report that shows the Hello, ActiveReportsJS Viewer
text. You can test the basic functionality by using the Report Viewer User Interface.