Get the App
SLTechnology News&Howtos  ›  Development  › 

How does WeChat Mini Programs quote other js files

Shulou Source: shulou.com Published: 2022-05-31 21:50:07 09月21日 Update

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.

Tags: Documents procedures knowledge industries links different no practical content practical practical interfaces articles methods more cases knowledge points articles information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Information Shulou Technology Docker OPPO Reno