Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the problems with the inheritance implementation of UI5 controls

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what are the problems of inheritance and implementation of UI5 controls". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Colleague C asked me this question.

Use the following code for extend UI5 standard controls.

Question1: why does line 35 trigger when new a JerryButton?

Var oJerryButton = new JerryButton ({application: oApplication})

Answer:

The implementation of debug extend, which assigns the constructor specified by calling extend to fnClass in line 330

Then assign fnClass to fnClass.prototype.constructor in line 352, In this way, every time you use the constructor fnClass to new a new instance, the function pointed to by the constructor will be automatically call.

# question 2

Why put the assignment of constructor outside the extend function and be explicitly assigned by application itself, but it will not be called in the case of new?

Answer:

The reason is that the constructor passed in is undefine, so fnClass is also undefine.

So what line 352 injects is actually the function of the dynamically generated function body of line 346 as fnBaseClass.apply, so of course our custom constructor will not be executed.

If you want to specify constructor outside the extend, how do you do it?

All you need is this:

This is the end of the content of "what are the problems with the inheritance implementation of UI5 controls". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report