How to reference other .js files in uniapp app.js

request.js has been globally referenced in the entry file main.js

import request from './common/request.js'; 
Vue.prototype.$request = request;

  Refer to the showErrorMsg method under the common/request.js folder in the js part of app.vue, which can be used directly

this.$request.showErrorMsg("网络断开!")

Guess you like

Origin blog.csdn.net/LzzMandy/article/details/126579580