跳至內容
選單
此問題已被標幟
1 回覆
1228 瀏覽次數

  _isRequired(fieldName) {

          const required = this.activeFields[fieldName].required;

          return required ? evaluateBooleanExpr(required,   this.evalContextWithVirtualIds) : false;

    }


Is it possible to patch the protected method, if yes means help me to patch the protected method in owl.

頭像
捨棄
最佳答案

Hi,

We can also patch the protected method. You can try this approach.


import { patch } from "@web/core/utils/patch";

import { ComponentToPath } from "@/path/to/your/component";


patch(ComponentToPath.prototype, {


    _isRequired(fieldName) {


        super()._isRequired(); // if needed old functionality


        // Your custom logic here



     }


});


Hope it helps

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
4月 25
2796
2
8月 24
3586
1
7月 24
1543
0
7月 24
1558
2
5月 24
4310