提交 7f1dd4de 编写于 作者: C chensi10

modification of reviews

Signed-off-by: Nchensi10 <chensi52@huawei.com>
上级 1ceee25e
......@@ -2310,9 +2310,17 @@ struct WebComponent {
Column() {
Button('hasImageCb')
.onClick(() => {
this.controller.hasImage((err, data) => {
console.log("hasImage: " + data);
});
try {
this.controller.hasImage((err, data) => {
if (error) {
console.info(`hasImage error: ` + JSON.stringify(error))
return;
}
console.info("hasImage: " + data);
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
})
Web({ src: 'www.example.com', controller: this.controller })
}
......@@ -2358,9 +2366,16 @@ struct WebComponent {
Column() {
Button('hasImagePm')
.onClick(() => {
this.controller.hasImage().then((data) => {
console.info("hasImage: " + data)
});
try {
this.controller.hasImage().then((data) => {
console.info('hasImage: ' + data);
})
.catch(function (error) {
console.error("error: " + error);
})
} catch (error) {
console.error(`Errorcode: ${error.code}, Message: ${error.message}`);
}
})
Web({ src: 'www.example.com', controller: this.controller })
}
......
......@@ -2393,7 +2393,7 @@ onDataResubmitted(callback: (event: {handler: DataResubmissionHandler}) => void)
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onDataResubmitted((event)=>{
.onDataResubmitted((event) => {
console.log('onDataResubmitted')
event.handler.resend();
})
......@@ -2426,7 +2426,7 @@ onPageVisible(callback: (event: {url: string}) => void)
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onPageVisible((event)=>{
.onPageVisible((event) => {
console.log('onPageVisible url:' + event.url)
})
}
......@@ -2464,7 +2464,7 @@ onInterceptKeyEvent(callback: (event: KeyEvent) => boolean)
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onInterceptKeyEvent((event)=>{
.onInterceptKeyEvent((event) => {
if (event.keyCode == 2017 || event.keyCode == 2018) {
console.info(`onInterceptKeyEvent get event.keyCode ${event.keyCode}`)
return true;
......@@ -2500,8 +2500,8 @@ onTouchIconUrlReceived(callback: (event: {url: string, precomposed: boolean}) =>
controller: web_webview.WebviewController = new web_webview.WebviewController()
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onTouchIconUrlReceived((event)=>{
Web({ src:'www.baidu.com', controller: this.controller })
.onTouchIconUrlReceived((event) => {
console.log('onTouchIconUrlReceived:' + JSON.stringify(event))
})
}
......@@ -2535,7 +2535,8 @@ onFaviconReceived(callback: (event: {favicon: image.PixelMap}) => void)
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onFaviconReceived((event)=>{
.onFaviconReceived((event) => {
console.log('onFaviconReceived:' + JSON.stringify(event))
this.icon = event.favicon;
})
}
......@@ -6177,7 +6178,7 @@ resend(): void
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onDataResubmitted((event)=>{
.onDataResubmitted((event) => {
console.log('onDataResubmitted')
event.handler.resend();
})
......@@ -6204,13 +6205,11 @@ cancel(): void
build() {
Column() {
Web({ src:'www.example.com', controller: this.controller })
.onDataResubmitted((event)=>{
.onDataResubmitted((event) => {
console.log('onDataResubmitted')
event.handler.cancel();
})
}
}
}
```
###
\ No newline at end of file
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册