智能客服
你问我答,随时在线为你解决问题
webview.once可以订阅一次指定类型Web事件的回调。一般在web初始化完成后可以注入。
- import { webview } from '@kit.ArkWeb'
-
- webview.once("webInited", () => {
- console.log("setCookie");
- webview.WebCookieManager.configCookie("https://www.example.com", 'a=b,c=d,e=f');
- })
-
- @Entry
- @Component
- struct WebComponent {
- controller: webview.WebviewController = new webview.WebviewController();
-
- build() {
- Column() {
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }