How does WeChat Mini Programs quote other js files
This article mainly introduces WeChat Mini Programs how to quote other js files, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
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! }}) Thank you for reading this article carefully. I hope the article "how WeChat Mini Programs quotes other js documents" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!