How does WeChat Mini Programs quote other js files
This article mainly introduces the relevant knowledge of "how WeChat Mini Programs quotes other js files". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope this article "how WeChat Mini Programs quotes other js files" can help you solve the problem.
How does WeChat Mini Programs quote other js files
1. Let's first set up a common.js file and write our program in common.js
Function myfunc () {console.log ("myfunc....");}
Module.exports.myfunc = myfunc; exposes the interface in this way, and cannot be referenced here without exposure
In the file domain js
Var common = require (".. /.. / common.js"); to link over, just linking over is not enough!
Var app;var common = require (".. /.. / common.js"); Page ({data: {}, onLoad:function () {app = getApp (); this.setData ({version:app.globalData.appName}); common.myfunc (); / / finally we need to execute to take effect! }}) this is the end of the introduction to "how WeChat Mini Programs quotes other js files". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.