我有一个Vue.js模块化应用程序,当我加载基本URL时,索引页会将我的引用加载到Stimulsoft JavaScript引用。因此,在我的index.html页面上-我已经尝试过在index.html文件中不同位置的脚本-Head-Body-在div之后的div应用程序之前-没有任何变化,同样的问题
<script src="/stimulsoft/stimulsoft.reports.js"></script>
<script src="/stimulsoft/stimulsoft.viewer.js"></script>
,当我在安装的事件中单击包含stimulsoft查看器代码的标签时:
var viewer = new window.Stimulsoft.Viewer.StiViewer(
null,
"StiViewer",
false
);
一切正常。但是,当我刷新该页面的浏览器时,上面的代码抛出错误,提示它不能
TypeError: Cannot read property 'Viewer' of undefined
如果我转到url并删除Vue页面引用并重新加载原始应用程序,然后单击该页面的导航按钮,一切将再次正常运行。
我的.vue页面的html是
<template>
<v-layout align-start justify-center row fill-height>
<v-content>
<v-container>
<v-layout>
<div id="viewer">Viewer</div>
</v-layout>
</v-container>
</v-content>
</v-layout>
</template>
脚本部分中唯一的代码是
export default {
data: () => ({
data: []
}),
methods: {
loadReportData: function() {
// this.isLoading = true;
// console.log("Loading Viewer view");
// console.log("Creating the report viewer with default options");
var viewer = new window.Stimulsoft.Viewer.StiViewer(
null,
"StiViewer",
false
);
// console.log("Creating a new report instance");
var report = new window.Stimulsoft.Report.StiReport();
// console.log("Load report from url");
report.loadFile("/reports/SimpleList.mrt");
// console.log(
// "Assigning report to the viewer, the report will be built automatically after rendering the viewer"
// );
viewer.report = report;
// console.log("Rendering the viewer to selected element");
viewer.renderHtml("viewer");
}
},
created: function() {
this.loadReportData();
}
};
</script>