我想在我的gsp页面中添加javascript小部件(https://www.tradingview.com/widget/market-overview/)。不确定最新版本的grails是否已停止,包括来自gsp文件的带有src标签的javascript文件。 在我的情况下,我需要包括以下脚本
<!-- TradingView Widget BEGIN -->
<span id="tradingview-copyright"><a ref="nofollow noopener" target="_blank" href="http://www.tradingview.com" style="color: rgb(173, 174, 176); font-family: "Trebuchet MS", Tahoma, Arial, sans-serif; font-size: 13px;">Market Quotes by <span style="color: #3BB3E4">TradingView</span></a></span>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-market-overview.js">
{
"showChart": true,
"locale": "en",
"width": "400",
"height": "400",
"plotLineColorGrowing": "rgba(60, 188, 152, 1)",
"plotLineColorFalling": "rgba(255, 74, 104, 1)",
"gridLineColor": "rgba(233, 233, 234, 1)",
"scaleFontColor": "rgba(218, 221, 224, 1)",
"belowLineFillColorGrowing": "rgba(60, 188, 152, 0.05)",
"belowLineFillColorFalling": "rgba(255, 74, 104, 0.05)",
"symbolActiveColor": "rgba(242, 250, 254, 1)",
"tabs": [
{
"title": "Equities",
"symbols": [
{
"s": "NASDAQ:AAPL",
"d": "Apple"
}
]
}
]
}
</script>
<!-- TradingView Widget END -->
我创建了一个仅包含此内容的新gsp页面,但图表未显示。如果我将它粘贴到任何html页面(jsfiddle或w3schools),它都可以。需要帮助。
答案 0 :(得分:0)
我想知道您的特定Widget是否存在问题,或者您传递的构造函数对象是否存在问题。
我能够将这一行包含在我的GSP中并且运行良好:
<script type='text/javascript' src='https://www.openhub.net/p/grails/widgets/project_users?format=js&style=green'></script>
也许您可以尝试来自同一网站的其他小部件?或者再看看你的构造函数对象?