在下面的代码中,我希望当点击次数增加时 webView 内容不会改变,但每次加载时,都会显示一个新的时间戳。
const webView = (
<WebView
source={{
uri:
'data:text/html,<html><script>document.write("<h1 style=\\"font-size:64px\\">"+Date.now()+"<h1>");</script>',
}}
/>
);
export default class App extends React.Component {
state = {
clicks: 0,
};
onClick = () => {
this.setState({ clicks: this.state.clicks + 1 });
};
render() {
return (
<View>
<Text onPress={this.onClick}>
Click Me: {this.state.clicks}
</Text>
{this.state.clicks % 2 === 0 ? webView : null}
{this.state.clicks % 2 === 1 ? webView : null}
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud)
链接到博览会小吃以在设备上检查它。
我刚刚使用jQuery prepend,无法按预期工作.
我在做什么:
每隔一秒将
.contentdiv添加到#maindiv
但是,当我向下滚动[一旦页面内容充满]时,我会继续滚动回到#main顶部或最新的前置.content
我如何能:
防止
viewport变化 - 就像追加一样
相关小提琴
可能重复:
任何编程语言中的变量名是否占用内存空间
我刚刚阅读有关内存分配的内容,不禁要问这个问题:
做到这两点
int x = 4;
Run Code Online (Sandbox Code Playgroud)
和
int this_is_really_really_long_name_for_an_integer_variable = 4;
Run Code Online (Sandbox Code Playgroud)
占用相同数量的内存(变量占用的总内存.不仅仅是)sizeof(int)
我知道这个问题与"编程语言和编译器构造"有关.但是,我没有研究它:(
我有这些字符串,我想b=(\d+)只匹配ab=(\d+).我该怎么做?
"ab=10&b=20" -> 20
"b=20&ab=10" -> 20
"b=20" -> 20
"ab=10" -> no match
Run Code Online (Sandbox Code Playgroud) c ×1
jquery ×1
php ×1
prepend ×1
react-native ×1
regex ×1
reparenting ×1
scroll ×1
variables ×1