我嘗試使用反應和OpenComponents創建一個小部件,當我嘗試使用我的部件客戶端反應部分加載正確,但JavaScript邏輯doesn沒有工作。我的小工具創建OpenComponents不使用是JavaScript邏輯客戶端
我看着控制檯,我沒有錯誤信息。之前使用反應我試着用把手我有問題。我也嘗試使用它服務器端它的工作完美。
這是我的index.html
<html>
<head>
<link rel="stylesheet" href="css/mycss.css">
<title>Widget</title>
</head>
<body>
<script>
var oc = {conf: {debug: true}};
</script>
<script src="http://localhost:3030/oc-client/client.js"></script>
<script src="js/header.js"></script>
<script src="js/app.js"></script>
<oc-component href="http://localhost:3030/mywidget"></oc-component>
</body>
</html>
我的組件
<script src="{{path}}js/app.js" language="JavaScript" type="text/javascript"></script>
<div id="magnet"></div>
<script src="{{path}}js/index.js" language="javascript" type="text/javascript"></script>
我的package.json
{
"name": "mywidget",
"description": "",
"version": "1.0.0",
"repository": "",
"oc": {
"files": {
"data": "server.js",
"template": {
"src": "template.html",
"type": "handlebars"
},
"static":["js"]
}
}
}
我server.js
'use strict';
module.exports.data = function(context, callback){
callback(null, {
path:context.staticPath,
init: {
to: context.params.to || 7015400,
from: context.params.from || 8727100,
depart: context.params.depart || '01/01/1900',
return: context.params.return || '01/01/1901',
point_of_sale: context.params.point_of_sale || "XXXXX"
}
});
};
感謝