Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3171 Lượt xem

Hello everyone , I have a template index, and it t-call template panel and header.
In template header , I defined an event click but when I click button , there are not run event 

Here is index.xml

<?xml version="1.0" encoding="UTF-8"?>

<templates xml:space="preserve">

    <t t-name="index">

        <div>

            <t t-call="header"/>

            <t t-call="panel"/>

        </div>

    </t>

</templates>

Here is header.js

odoo.define('erpvn_action_scan.Header', function (require) {

    "use strict";

    

    var AbstractAction = require('web.AbstractAction');

    var core = require('web.core');

    var _t = core._t;

    

    var Header = AbstractAction.extend({

        contentTemplate: 'header',

    

        events: {

            "click .btn_home": "handleClickHome",

        },

    

        init: function(parent, action) {

            this._super.apply(this, arguments);

          

        },

    

        willStart: function () {

            var self = this;

            return this._super.apply(this, arguments).then(function () {

               

            });

        },

    

        start: function() {

            var self = this;

            return this._super.apply(this, arguments);

        },

    

        destroy: function () {

            this._super();

        },

    

    

        _onBarcodeScanned: function(barcode) {

        

        },

        handleClickHome: function (e) {

           alert('Home')

        },

    });

    

    core.action_registry.add('header', Header);

    

    return {

        Header: Header,

    };

    

    });

    

But when I define event click in file index.js, it run and alert message.
So, when using t-call a template, why JS file of that template not working  

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 21
10
0
thg 1 22
223
1
thg 3 25
2562
0
thg 5 23
3234
1
thg 1 23
8031