我正在尝试获取控制台日志的结果并将其放入div中。控制台日志位有效,但不能放入div中。根据在线教程,应该是这样的:
public class UserRole implements Serializable {}
但是我没有收到任何日志错误,只是没有更新文本。
答案 0 :(得分:2)
使用
import{ IntlProvider,addLocaleData } from "react-intl";
import messages from "./messages";
import{locale} from "./reducers/locale";
import {setLocale} from "./actions/locale";
class App extends React.Component {
render() {
const { location, isAuthenticated, loaded, lang } = this.props;
console.log(lang);//undefined in console
return (
<IntlProvider key={ lang } locale={lang} messages={messages}>
</IntlProvider>
);
}
代替.innerHTML
答案 1 :(得分:0)
尝试$("#number").append(data.report.data[0].breakdown[0].counts);
,如果要在每次请求后更改数据,请在附加之前使用$("#number").empty()
答案 2 :(得分:0)
由于您使用的是jQuery选择器source
,因此需要使用$
。
或者,如果您想使用Vanila Javascript,也可以执行$('#number').html("text or something")
。
答案 3 :(得分:0)
> server {
> server_name localhost;
> index index.php index.html;
> root /var/www/public;
>
> location / {
> try_files $uri /index.php?$args;
> }
>
> location ~ \.php$ {
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
> fastcgi_pass php:9000;
> fastcgi_index index.php;
> include fastcgi_params;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> fastcgi_param PATH_INFO $fastcgi_path_info;
> } }
>
> server { listen 80; listen [::]:80; return
> 301 https://$host$request_uri; }
是一个jquery对象,$('#number')
适用于DOM对象-它们不是同一件事。
使用以下方法将.innerHTML
转换为DOM:
$('#number')
或使用jquery方法:
$('#number')[0].innerHTML = data.report.data[0].breakdown[0].counts;