0

我有以下用于 Qlik Sense 混搭的 HTML 代码。这段代码在我的本地机器上运行良好,但每当我在服务器上部署它时都会引发错误。我从 JavaScript 中收到“未捕获的 TypeError,如下所示:

在此处输入图像描述

下面是我的 HTML 代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
  <title>Search Example - Simple</title>
<link rel="stylesheet" href="https://branch.qlik.com/anon/resources/assets/client/client.css">
<link rel="stylesheet" href="sense-search.css"/>
</head>
<body style="width: 80%; margin: 20px auto; font-family: arial;">
<h2>Search Example - Simple</h2>

<p>
  The Search Input and Search results have been added via HTML.
</p>
<sense-search-input id="myInput" mode="visualizations"></sense-search-input>
<sense-search-results id="myResults"></sense-search-results>
<script type="text/javascript" src="https://branch.qlik.com/anon/resources/assets/external/requirejs/require.js"></script>
<script type="text/javascript" src="sense-search.js"></script>

<script type="text/javascript">
/*  
var config = {
host: window.location.hostname,
prefix: "/",
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
});
*/

var config = {
isSecure: true,
host: "****.abc.com",
port: 443,
prefix: "/"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
} );

require( ["js/qlik"], function ( qlik ) {
qlik.setOnError( function ( error ) {
    alert( error.message );
} );

var app = qlik.openApp('8435df1b-0473-4fd9-96b4-a488f051ceff', config);
app.model.waitForOpen.promise.then(function(){
   senseSearch.connectWithCapabilityAPI(app);
});

});
/*
var myInput = new SenseSearchInput("myInput");
document.getElementsByTagName("body")[0].appendChild(myInput.element);
senseSearch.connect(config, function(){
myInput.object.attach();
});
*/
</script>

请帮我解决这个问题。我无法找到出路。

4

0 回答 0