Home > Article > WeChat Applet > WeChat mini program comprehensive in-depth analysis video tutorial resource sharing
WeChat Mini Program is a new application form released by WeChat on September 15, 2016. It is an application that does not require downloading and installation. "WeChat Mini Program Comprehensive In-depth Analysis Video Tutorial" will take you through the complete process from the most basic environment construction, configuration, API use to developing an app.
Course broadcast address: http://www.php.cn/course/248.html
The teacher’s teaching style:
Teachers’ lectures are simple and in-depth, with clear organization, layer-by-layer analysis, interlocking links, rigorous argumentation, and rigorous structure. They use the logical power of thinking to attract students’ attention and use reason to control the classroom teaching process. By listening to the teacher's lectures, students not only learn knowledge, but also receive thinking training, and are also influenced and influenced by the teacher's rigorous academic attitude
The more difficult point in this video is the scope and modularization :
File Scope
Variables and functions declared in a JavaScript file are only valid in that file; variables and functions with the same name can be declared in different files without affecting each other.
Example:
The global application instance can be obtained through the global function getApp(). If global data is needed, it can be set in App(), such as:
/* app.js */ App({ globalData: 1 })
/* a.js */ // 这是局部变量localValue var localValue = 'a' // 获取app.js的实例 var app = getApp() // 通过app的示例来操作全局的变量 app.globalData++
/* b.js */ // 在不同的文件中可以重复定义localValue这个变量 var localValue = 'b' // 如果a.js文件先执行,那么b.js获取到的就是a.js执行过的变量数值 console.log(getApp().globalData)
Modularization
We can extract some public code into a separate js file as a module. Modules can only expose interfaces to the outside world through module.exports or exports.
Example:
/* common.js */ function sayHello(name) { console.log(`Hello ${name} !`) } module.exports = { sayHello : sayHello}
In the files that need to use these modules, use require(path) to introduce the public code
/* a.js */ var common = require('common.js') Page({ helloMINA: function() { common.sayHello('MINA') } })
The above is the detailed content of WeChat mini program comprehensive in-depth analysis video tutorial resource sharing. For more information, please follow other related articles on the PHP Chinese website!