我无法从React中的表行调用click事件.以下是我的代码.我有一个单独的函数来单独填充行,但似乎我正在搞乱绑定信息.
import React, {Component, PropTypes} from 'react';
import Header from './Header';
export default class SongData extends Component {
constructor(props, context) {
super(props, context);
}
isEmpty(obj) {
return Object.keys(obj).length === 0;
}
fetchDetails(song) {
console.log(song);
}
renderResultRows(data) {
var self = this;
return data.map(function(song) {
return (
<tr onClick={self.fetchDetails(song)}>
<td data-title="Song">{song.S_SONG}</td>
<td data-title="Movie">{song.S_MOVIE}</td>
<td data-title="Year">{song.S_YEAR}</td>
</tr>
);
}.bind(this));
}
render() {
return (
<div id="no-more-tables">
<table className="table table-hover table-bordered table-striped">
<thead>
<tr>
<th>Song</th>
<th>Movie</th>
<th>Year</th>
</tr>
</thead>
<tbody>
{!this.isEmpty(this.props.searchResult)
? this.renderResultRows(this.props.searchResult) …Run Code Online (Sandbox Code Playgroud) 我正在使用React + Electron + Webpack创建一个应用程序,但是在尝试使用Electron模块时,出现了错误提示“找不到模块'electron'。
我的React组件之一中包含以下示例代码:-
const shell = window.require("electron").shell;
shell.showItemInFolder("C:\\Logs");
Run Code Online (Sandbox Code Playgroud)
我已经提到了SO中与webpack和Electron有关的许多问题,但是似乎没有一种解决方案适合我。
当我尝试以下代码时:-
require('electron-prebuilt')
Run Code Online (Sandbox Code Playgroud)
它使我回到了电子可执行文件的路径。
reactjs ×2
containers ×1
docker ×1
electron ×1
javascript ×1
kubernetes ×1
node.js ×1
webpack ×1