ExtJs -- 07 -- Ext. define defines the process of a class

Source: Internet
Author: User

ExtJs -- 07 -- Ext. define defines the process of a class

Ext. onReady (function () {// Ext defines a class Ext. define ("Person", {config: {name: "jack", age: 22}, fangfa: function () {Ext. msg. alert ("title information", "prompt content information")}, constructor: function (config) {// test constructor call and parameter passed in no // for (var attr in config) {// alert (attr + ":" + config [attr]); //} this. initConfig (config) ;}}); // you can directly obtain the attribute value of the initialized object. // var p = new Person (); // document. writeln (p. getName (); // after passing the config object parameter to the constructor through new, you can get the value from the object reference. // var p1 = new Person ({name: "tom", age: 33}); // document. write (p1.name) // recommended // This method can also be used to create an object and obtain the attribute value var p2 = Ext from the object reference. create ("Person", {name: "mary", age: 88}); document. write (p2.getName () document. write ("
") Document. write (p2.getAge ())});

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.