我正在尝试用角度2创建一个应用程序; 我想要在*ngFor中呈现最后一个元素时,执行一个函数,像这样,tag是<img>:
<img *ngFor="let image of template.previewImages; let i = index" [src]="image" [class.hs_visible]="i==0" />
Run Code Online (Sandbox Code Playgroud)
功能名称是
animation(){console.log('enter');}
Run Code Online (Sandbox Code Playgroud) 我对 JSON 对象/数组和映射方法的语法和结构有困难。我是 React 的新手并且处于学习的初始阶段。
这是我粘贴在下面的 JSON 文件代码:
[
{
"cloud":"Asia",
"availability":{
"last15Min":"100%",
"last24Hour":"100%"
},
"data_centers":[
{
"title":"Bombay",
"availability":{
"last15Min":"100%",
"last24Hour":"100%"
}
},
{
"title":"Bombay1",
"availability":{
"last15Min":"100%",
"last24Hour":"100%"
}
}
]
},
{
"cloud":"Europe",
"availability":{
"last15Min":"100%",
"last24Hour":"100%"
},
"data_centers":[
{
"title": "Bombay",
"availability": {
"last15Min": "100%",
"last24Hour": "100%"
}
},
{
"title":"Bombay1",
"availability":{
"last15Min":"100%",
"last24Hour":"100%"
}
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
到目前为止,这是我的代码:我想使用 map 方法呈现每个字段。这样做的正确方法是什么?
在 componentDidMount 我在 console.log http://prntscr.com/i09rqt 中得到响应
constructor(props) {
super(props)
this.state = {
clouds:[]
}
}
componentDidMount() …Run Code Online (Sandbox Code Playgroud) 我正在使用一个固定位置的窗口,水平和垂直滚动.并使用position.top()来查找div的特定位置.
var position = anchor.position().top;
Run Code Online (Sandbox Code Playgroud)
但是当缩放为1或> 1时,它的工作完全正常.但是当缩放<1时,则存在不一致.
示例Jsfiddle
我想隐藏并在检查时显示div并取消选中复选框.我正在找父母并找到我要隐藏的div.但是代码没有运行
Jquery是:
$('.show-check').click(function() {
if (this.checked) {
$(this).parent().find('.div-check').fadeIn('slow');
} else
$(this).parent().find('.div-check').fadeOut('slow');
});
Run Code Online (Sandbox Code Playgroud)
HTML:
<div class="type-details">
<span class="form-label">Logo:</span>
<div class="switch">
<label>
<input type="checkbox" class="show-check" checked>
<span class="lever"></span>
</label>
</div>
<div class="landing-inputfile div-check">
<div class="col-xs-12 no-padding">
<div class="input-group">
<input type="text" class="file-input" placeholder="No file" readonly>
<label class="input-group-btn">
<span class="btn btn-default btn-flat btn-basic2">
UPLOAD <input type="file" style="display: none;">
</span>
</label>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)