我有一个问题与框架V12。我不知道javascript是否加载了,或者还有另一个问题:
odoo.define('titi.Home',['web.core','web.Dialog','web.Class'], function(require) {
"use strict";
var core = require('web.core'),
Dialog = require('web.Dialog'),
Class = require('web.Class');
var TitiHouse = Dialog.extend({
template: 'titi.her_house_name',
events: {
'click a#titi_s_house_name a': '_onClick',
},
init: function(parent, params) {
var self = this;
var options = _.extend({
size: 'large',
buttons: [{
text: params.titi_s_house_name,
click: self._onClick,
classes: 'btn-secondary',
}],
}, params || {});
self._super(parent, options);
},
_onClick: function(event) {},
willStart: function() {
console.log('Will start .....');
},
start: function() {
console.log('Start !!!');
},
});
return TitiHouse;
});我什么时候可以在模板中执行这个javascript文件?或者如何在模板中执行该脚本?
发布于 2020-05-14 09:42:32
有几个因素可能会导致这个问题:
1-您没有在willStart或start中调用对话框小工具的超级方法。试着这样做:
...
willStart: function() {
console.log('Will start .....');
return this._super.apply(this, arguments);
},
start: function() {
console.log('Start !!!');
return this._super.apply(this, arguments);
},
...2-您不是在扩展事件,而是在覆盖它们。您需要将事件设置为param:
events: _.extend({}, Dialog.prototype.events, {
'click a#titi_s_house_name a': '_onClick',
}),尝试更改这些设置,看看是否有帮助。
https://stackoverflow.com/questions/57480300
复制相似问题