自定义钩子 myCustomer
/** @odoo-module **/
import {registry} from '@web/core/registry';
const myService = {
dependencies: [],
async: [
'getName'
],
start(env){
return {
getName(){
return "客户服务";
},
getDesc:() => {
return "描述"
},
getHah(){
return "hahah1111111111111"
},
getHa:() => {
return "hahah"
},
}
}
}
registry.category("services").add("myCustomer", myService)
其他文件引用
this.mycustom = useService('myCustomer');
const result = await this.mycustom.getName();
console.log(result);
console.log(this.mycustom.getDesc());
console.log(this.mycustom.getHa());
console.log(this.mycustom.getHah());
加载 2s
this.ui.block();
setTimeout(() => {
this.ui.unblock();
}, 2000)