2016-08-18 39 views
0

鑑於電子的WebView像不能使用電子的屬性的WebView在陣營組件

<webview 
    minwidth="300" 
    minheight="300" 
    src="http://www.javascript-coder.com/files/window-popup/javascript-window-open-example1.html" 
    allowpopups 
></webview> 

直接app.html它工作正常使用。

但是當我在反應組件或ReactDom.render中使用它時,它會省略除src之外的所有道具。所以,在彈出不要點擊打開:

import React from 'react'; 
import { render } from 'react-dom'; 

render(
    <webview 
    minwidth="300" 
    minheight="300" 
    src="http://www.javascript-coder.com/files/window-popup/javascript-window-open-example1.html" 
    allowpopups 
    />, 
    document.getElementById('root') 
); 

在devtools我得到

警告:未知道具minwidthminheightallowpopups上 標籤。從元素中移除這些道具。有關詳細信息,請參閱 https://facebook.github.io/react/warnings/unknown-prop.html

提示:我用的是最新的https://github.com/chentsulin/electron-react-boilerplate

任何想法?

+0

您可以爲webview添加組件類代碼嗎? –

+0

我添加了一個小例子 – sokki

+0

你可以在組件上嘗試'minWidth'和'minHeight'嗎?注意駱駝 –

回答

1

您需要將webview元素包裝到React組件中,並讓該組件創建並將元素插入到componentDidMount()的DOM中。有關更多詳細信息,請參見this issue