Operations in the daily work may write a lot of scripts to complete certain functions, such as operations A to write a version of the code released, there will be the logic of the file push, Ops B want to implement a remote script to execute the function, perhaps in his code also has the logic of file Push. In the absence of the introduction of the concept of atomization design, operations and maintenance personnel in their own way to implement the logic of the file Push.
of course, It is not possible for us to encapsulate a component directly to use this Tpl. instead, it provides an external component function and passes the parameters into this component function, which not only renders the page (that is, the component dom), but also the related logic. As the above rightsidebar.js is to provide a component function for the Outside. The Rightsidebar component is simple and only needs to pass a parent node, and no additional external data is required for Processing. Part
The GetUserInfo function, as the name implies, is to obtain the login user information, equivalent to this function provides the interface to obtain user information, other pages do not invoke nature will not Execute. Other pages through Getapp (). getuserinfo (function (userinfo) {console.log (userinfo);}) This way, the method is called to get the user Information.
Getuserinfo:function (cb) {///parameter is cb, type is function var that = this if (this.globalData.userInfo) {//user information is not empty typeof CB = = "function" && CB (this.globalData.userInfo)//if The parameter CB type is a function, then execute cb, obtain user information; }else{//if The user information is empty, This means that the first call to GetUserInfo will invoke the user login Interface. wx.login ({ success:function () { wx.getuserinfo ({ success:function (res) {console.log (res)
that.globaldata.userinfo = Res.userinfo//the User information is assigned to globalData, if the GetUserInfo function is called again, do not need to call the login interface typeof cb = = " Function "&& CB (that.globalData.userInfo)//if The parameter CB type is a function, execute cb, get user information}})} ) } }
Nonsense not much to say, direct analysis of front-end Code. Personal views, There are inevitably omissions, for reference only.
First look at the entry App.js,app (obj) to register a small Program. Accepts an object parameter, which specifies the life cycle function of the applet, and so On. Other files can use the global method Getapp () to get an app instance and call its properties or methods directly, For example (getapp (). globalData) http://www.cnblogs.com/koetgw/
Any object to access this class can only be accessed through this instance object, we compare the house to a Java class, each house has only one key (like each class has only one instance), so that only the owner of the house has this key to access the house, other people can not access. http://www.cnblogs.com/mseruq/
Data:data represents the $http () object that contains the data that will be sent to the server as the body of the Message. Typically used when sending a post Request.
According to this project, the author thinks: If you do not need to pass the data to the server, it does not need the key, if you need to pass the data to the server, you need to use data this key.
Now that we have finished analyzing, we will solve the problem of Webapi starting Https. Start thinking about a free certificate to apply for, but because the WEBAPI is installed in the local Windows service and IP is not fixed, so the free certificate is no longer desirable, can only create a certificate to solve this Problem. But I almost never contacted the certificate, know nothing about it, where to start, this long process Began.
JSON can be parsed directly using Javascript's built-in approach, making it easy to convert to JavaScript http://www.cnblogs.com/mseruj/
I thought of it first. you can save the dragged element in a variable in the DragStart event handler, and then drop the event handler to access it. But unfortunately, and cannot access it.
There are some questions about JSON when learning Ajax