增加移除焦点的controller

This commit is contained in:
胡尧
2024-08-20 14:05:05 +08:00
parent 54fc91baa2
commit a767c6491f
3 changed files with 25 additions and 6 deletions

View File

@@ -0,0 +1,23 @@
/** @odoo-module **/
import { registry } from '@web/core/registry';
import { formView } from '@web/views/form/form_view';
import { FormController } from '@web/views/form/form_controller';
import { onRendered, onMounted } from "@odoo/owl";
export class RemoveFocusController extends FormController {
setup() {
super.setup();
onMounted(() => {
this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur());
})
}
}
registry.category('views').add('remove_focus_view', {
...formView,
Controller: RemoveFocusController,
});