我正在尝试修复这两个警告:
Warning: validateDOMNesting(...): <td> cannot appear as a child of <tbody>.
Warning: Each child in a list should have a unique "key" prop.
Run Code Online (Sandbox Code Playgroud)
这是我的表 js 文件:
<table className="table table-hover">
<thead>
<tr>
<th scope="col"style={{width: "10%"}}>ID</th>
<th scope="col"style={{width: "10%"}}>Name</th>
<th scope="col"style={{width: "10%"}}>Price $</th>
<th scope="col" style={{width: "10%"}}>Quantity</th>
<th scope="col" style={{width: "10%"}}>Total $:</th>
<th scope="col" style={{width: "10%"}}>Total €:</th>
<th scope="col" style={{width: "20%"}}>Remove:</th>
<th scope="col" style={{width: "20%"}}>Change Quantity:</th>
</tr>
</thead>
{this.state.products.map(data=>
<tbody>
<td>{data.id}</td>
<td>{data.name}</td>
<td>{data.price}</td>
<td>{data.quantity}</td>
<td>{data.quantity*data.price}</td>
<td>{Math.round(data.quantity*data.price*0.92)}</td>
<td>
<button type="button" onClick={(e)=>this.handleSubmitRemove(data.id)} className="btn btn-danger">Remove</button> …Run Code Online (Sandbox Code Playgroud) 我正在使用querySelectorfetchdiv来滚动该位置。
const anchor = document.querySelector('#' + i)
if (anchor) {
anchor.scrollIntoView(true);
window.scrollBy(0, -190);
}
Run Code Online (Sandbox Code Playgroud)
问题是,在某些 div 中,我的 id 带有空格,例如 Vegan Pizza(变量 i),在这种情况下,变量anchor是null并且滚动不起作用。
任何人都知道如何使 querySelector 与带有空格的 id 一起使用?
我在 react native 中有 android 和 ios 应用程序,它们都使用 webview 将网页显示为应用程序。由于我不得不更改包名称以将其部署在 google play 上,因为第一个包名称已被占用。我更改了 app.json 文件和 android 文件夹中的所有名称,没关系。
现在我的问题是我需要在我的 ios 文件夹中更改什么才能让我的应用程序在 xcode 中工作。我有这个错误。
不变违规:“RestApp”尚未注册。在以下情况下可能会发生这种情况:
- Metro(本地开发服务器)从错误的文件夹运行。检查 Metro 是否正在运行,将其停止并在当前项目中重新启动。
- 模块因错误而
AppRegistry.registerComponent无法加载且未被调用。
这是我的 app.json 文件
{
"name": "restapphhopp",
"displayName": "RestApphhopp"
}
Run Code Online (Sandbox Code Playgroud)
Index.js 文件
/**
* @format
*/
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
Run Code Online (Sandbox Code Playgroud) 我正在使用 Electron 构建便携式 Node.js 服务器。我正在使用 SQLITE 数据库来存储数据。
在开发模式下,我将数据库文件放在test.db我的目录中Main.js,一切都运行良好。
当我部署我的应用程序时electron-builder --mac并运行它时,它无法访问数据库文件。(文件未找到)
所以我的问题是我应该在哪里存储我的test.db文件,以便它可以在开发和生产模式下工作?
是否可以在为 win/mac/linux 创建应用程序时嵌入 db 文件,以便最终用户无需关心 db 文件位于何处?
谢谢