我尝试了下面的代码,但没有奏效。我正在使用Angular4。如果句柄点击的输入不小于3,我想触发点击事件。
import { Component, OnInit, ElementRef } from '@angular/core';
@Component({
selector: 'box-frame',
template: `
<div>
<div (click)="handleClick(i)" id="box{{i}}" *ngFor="let i of array"></div>
</div>
`
})
export class BoxFrameComponent implements OnInit {
array: any = [1, 2, 3, 4, 5, 6];
constructor(private eleRef: ElementRef) { };
ngOnInIt() {
};
handleClick(n: number) {
if (n < 3) {
console.log(n);
} else {
let smallBox = this.eleRef.nativeElement.querySelector('#box' + n - 1);
//this didn't work
smallBox.dispatchEvent('click');
}
};
};
答案 0 :(得分:1)
from P4 import P4
import logging
FORMAT = '%(asctime)-15s: %(name)s: %(levelname)s : %(message)s'
logging.basicConfig(format=FORMAT, filename='/var/log/pytest.log', level=logging.INFO)
def reader():
p4 = P4()
p4.port = "ssl:perforce1.cec.lab.emc.com:1666"
p4.user = "perforce"
p4.charset = 'utf8'
p4.password = "Password"
p4.connect()
p4.run_trust("-i", '80:25:3E:E0:A6:58:8E:13:4F:9E:8C:C8:BF:C3:26:C2:91:2F:78:33')
p4.run_login()
result = p4.run('license', '-u')
logging.info ("User limit is :" + result[0].get('userLimit'))
#
p4.disconnect()
reader()