问题是在问题标题中,您正在尝试在render_products方法中显示{product.trating}。它不是一个数字,而是{速率,计数}作为密钥的对象。请参考以下代码。
import React, { useState, useEffect } from "react";
import axios from "axios";
const idealoBackendUrl = "https://fakestoreapi.com/products"
function App() {
const render_products = (Products) => {
return <div className='category-section fixed'>
<h2 className="text-3xl font-extrabold tracking-tight text-gray-600 category-title">Products</h2>
<div className="m-6 p-3 mt-10 ml-0 grid grid-cols-1 gap-y-10 gap-x-6 sm:grid-cols-2 lg:grid-cols-6 xl:gap-x-10" style={{ maxHeight: '800px', overflowY: 'scroll' }}>
{/* Loop Products */}
{Products.map(product => (
<div className="group relative shadow-lg" >
<div className=" min-h-80 bg-gray-200 aspect-w-1 aspect-h-1 rounded-md overflow-hidden group-hover:opacity-75 lg:h-60 lg:aspect-none">
<img
alt="Product Image"
src=""
className="w-full h-full object-center object-cover lg:w-full lg:h-full"
/>
</div>
<div className="flex justify-between p-3">
<div>
<h3 className="text-sm text-gray-700">
<a href={product.href}>
<span aria-hidden="true" className="absolute inset-0" />
<span style={{ fontSize: '16px', fontWeight: '600' }}>{product.item_name}</span>
</a>
<p>Tag -</p>
</h3>
{/* Here was the issue */}
<p className="mt-1 text-sm text-gray-500">Rating: {product.rating.rate}</p>
</div>
<p className="text-sm font-medium text-green-600">${product.current_price}</p>
</div>
</div>
))}
</div>
</div>
}
const [itemData, setItemData] = useState(null);
const [error, setError] = React.useState(null);
useEffect(() => {
getItemDataWithAxios().then(r => console.log(r));
}, []);
const getItemDataWithAxios = async () => {
const response = await axios.get(idealoBackendUrl);
console.log('print response data')
console.log(response.data);
setItemData(response.data);
};
if (error) return `Error: ${error.message}`;
if (!itemData) return <center style={{ marginTop: '200px' }}> <img src="https://icons8.com/preloaders/preloaders/1474/Walk.gif" style={{ width: '70px' }} /> </center>;
return (
<div className="flex fixed flex-row">
<div className="h-screen bg-slate-800 p-3 xl:basis-1/5" style={{ minWidth: '65%' }}>
<img className="w-full" src="" alt="Sunset in the mountains" />
<div className="px-6 py-4">
<h1 className="text-3xl mb-2 font-bold text-white"> Idealo product catalog </h1>
<p className="text-gray-700 text-white">
by - <b style={{ color: 'orange' }}>Sithija</b>
</p>
</div>
</div>
<div className="ml-5 p-10 xl:basis-4/5">
{render_products(itemData)}
</div>
</div>
// </>
);
}
export default App;
随意编辑代码以包含您的徽标组件和其他图标,我将其删除,因为我没有这些项目的副本。
一个选项是首先汇总数据以计算 Yellowcards
和 GAMES
by leagueCountry
的数量。之后,您可以将长时间转换为长时间,从而可以轻松地通过 ggplot2
绘制。
使用一些虚假的随机示例数据模仿您的真实数据:
set.seed(123)
new_soccer_referee <- data.frame(
player = sample(letters, 20),
leagueCountry = sample(c("Spain", "France", "England", "Italy"), 20, replace = TRUE),
yellowCards = sample(1:5, 20, replace = TRUE),
games = sample(1:20, 20, replace = TRUE)
)
library(dplyr)
library(tidyr)
library(ggplot2)
new_soccer_referee_long <- new_soccer_referee %>%
group_by(leagueCountry) %>%
summarise(across(c(yellowCards, games), sum)) %>%
pivot_longer(-leagueCountry, names_to = "variable", values_to = "number")
ggplot(new_soccer_referee_long, aes(leagueCountry, number, fill = variable)) +
geom_col(position = "dodge")
将此依赖性添加到pom.xml
org.hibernate Hibernate-entityManager 5.2.3.final
这在很大程度上取决于 speed
在 data
类中的类是具有某些代码执行或仅是正常字段的属性。
没有太大的区别:
public float speed = 2f;
对绩效有影响:
public float speed {
get {
return ExpensiveFunction();
}
}
这是一个仅在原始lapply中进行的示例,正如我在评论中提到的那样
library(dplyr)
library(readr)
lapply(list_of_files, \(f) {
read_csv(f, col_names=TRUE) %>%
rename_with(~c("A", "B", "C", "D")) %>%
mutate(newcol1 = paste0(A,B),newcol2 = paste0(C,D))
})
您应该看一下sectionList的外推道。当数据更新时,Extradata更新列表
只需将您的帖子ID纳入路径:
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Entity\Post;
class ArticleAdminController extends BaseController
{
public function temporaryUploadAction(Request $request, Post $post, string $projectDir)
{
/** @var UploadedFile $uploadedFile */
$uploadedFile = $request->files->get('image');
$uploadedFile->move("{$projectDir}/private/{$post->getId()}");
}
}
要仅在特定分支上提出拉请请求时运行阶段,您可以在舞台上设置条件。
condition: and(eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/branchname'), eq(variables['Build.Reason'], 'PullRequest'))
以下是一个示例:
stages:
- stage: A
condition: and(eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/branchname'), eq(variables['Build.Reason'], 'PullRequest'))
jobs:
- job: A1
steps:
- script: xx
您可以使用预定义的变量: system.pullrequest.targetBranch
和 build.Reason
来过滤触发方法并拉请求目标分支。
我设法找到了解决方案。这是浏览器,我猜是对https:// 2f81239fe704/(是docker容器hostname)和我的任何nginx.conf更改的第一个不正确的重定向响应。清洁cookie和网站数据后,更改为nginx.conf实际上会产生效果。最后,我最终得到了:
server_name localhost;
if ($scheme = http) {
return 301 https://localhost:8021$request_uri;
}
要在Keras中创建自定义内核初始化,请尝试以下类似:
import numpy as np
import tensorflow as tf
import keras
from keras.models import Sequential
from keras.layers import Dense
from sklearn.datasets import load_breast_cancer
X,y = load_breast_cancer(return_X_y =True)
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.3,random_state=1)
def my_custom_initialization(shape, dtype=None):
return tf.random.normal(shape, dtype=dtype)
model = Sequential()
model.add(Dense(units=30,input_dim=X_train.shape[1],activation='relu',
kernel_initializer=my_custom_initialization))
model.add(Dense(units=20,activation='relu',
kernel_initializer=my_custom_initialization))
model.add(Dense(units=1,activation='sigmoid',
kernel_initializer=my_custom_initialization))
model.compile(optimizer='sgd',loss='binary_crossentropy',metrics=['accuracy'])
model.fit(X_train,y_train,validation_data=(X_test,y_test),epochs=3,batch_size=40,verbose=1)
输出:
Epoch 1/3
10/10 [==============================] - 2s 65ms/step - loss: 598388.8750 - accuracy: 0.5553 - val_loss: 0.6913 - val_accuracy: 0.6316
Epoch 2/3
10/10 [==============================] - 0s 9ms/step - loss: 0.6907 - accuracy: 0.6256 - val_loss: 0.6898 - val_accuracy: 0.6316
Epoch 3/3
10/10 [==============================] - 0s 8ms/step - loss: 0.6893 - accuracy: 0.6256 - val_loss: 0.6883 - val_accuracy: 0.6316
假设您的项目被构建为-A.Jar
而且该a.jar取决于另一个库-B.Jar
两个罐子都取决于log4j.jar的记录目的。
在这种情况下,您将将log4j作为运行时依赖关系添加到B.Jar的POM中,以便无需任何问题就可以编译。
当通过其POM建立a.jar时,将包括log4j和b.jar。
这也将有助于避免运行时方法冲突。
经过一番研究,我在必须具有EIP55校验和。但是,由于API提供了检查和创建这些功能的功能,因此我认为我尝试了一下,并且可以使用!
因此,在功能开始时添加了一条线之后:
to_public=web3.toChecksumAddress(to_public)
它可以使用。
您可以将字符串连接起来:
let str = 'prefix';
str = str + ' ';
// str === 'prefix '
或者,如果要将任何大小的字符串粘贴到指定的长度:
let str = 'prefix';
str = str.padEnd(7, " ");
// str === 'prefix '
您的json
内部循环
your json
inside for loop
如何在JavaScript中访问JSON对象?