uniapp引入通用方法

uniapp引入通用方法测试:

新建common.js:

const toastSuccess = function(){
   uni.showToast({
       title: "操作成功",
       icon: 'success',
       duration: 1500
   });
}

module.exports = {
    toastSuccess
}

使用到的vue文件引入该js:

import common from "@/common.js";

测试:

onLoad(option) {
  var that = this;
  common.toastSuccess();
},

结果:

 以上;

 

posted @ 2021-11-20 18:40  丙炎  阅读(789)  评论(0)    收藏  举报