我正在建立一个选股申请.我发现这个图表模板真的很棒,它带有一个html脚本:
<!-- TradingView Widget BEGIN -->
<div id="tv-medium-widget-b3840"></div>
<script type="text/javascript" src="https://d33t3vvu2t2yu5.cloudfront.net/tv.js"></script>
<script type="text/javascript">
new TradingView.Widget({
"container_id": "tv-medium-widget-b3840",
"symbols": [
[
"Apple",
"AAPL "
],
[
"Google",
"GOOGL"
],
[
"Yahoo!",
"YHOO"
]
],
"gridLineColor": "#e9e9ea",
"fontColor": "#83888D",
"underLineColor": "#dbeffb",
"trendLineColor": "#4bafe9",
"width": 1000,
"height": 350,
"tradeItWidget": false,
"locale": "en"
});
</script>
<!-- TradingView Widget END -->
Run Code Online (Sandbox Code Playgroud)
我的问题是如何将它放在react-routing路由的react组件中?我只是在html中保留了脚本标签,并尝试在组件内调用构造函数,但它在所有页面上呈现为画布而不是路由器指向的那个.
const TradingViews = React.createClass({
componentDidMount:
new TradingView.widget({
"width": 980,
"height": 610,
"symbol": "QUANDL:YAHOO/FUND_FUSEX",
"interval": "M",
"timezone": "Etc/UTC",
"theme": "White",
"style": "1",
"locale": "en", …Run Code Online (Sandbox Code Playgroud) 我正在研究一种算法,该算法接受一个字符串进行输入并反转字符串的元音.str ='hello'应该返回'holle'str ='wookiE'应该返回'wEikoo'
我想知道的是你能使用str.replace吗?
function reverseVowels(str) {
return str.replace(/[aeiou]/-g, /[aeiou]+1/);
}
Run Code Online (Sandbox Code Playgroud)
我不确定替换函数的第二个参数是什么.我在想的是找到第一个元音,然后转到下一个元音替换它.这可以通过这种方法完成,还是需要forEach/for循环?