| 123456789101112131415161718192021222324252627282930 |
- const requst = (opt) => {
- opt = opt || {};
- opt.url = opt.url || '';
- opt.data = opt.data || null;
- opt.method = opt.method || 'POST';
- opt.header = opt.header || {
- "Content-Type": "application/x-www-form-urlencoded"
- };
- opt.success = opt.success || function () {};
- uni.request({
- url: opt.url,
- data: opt.data,
- method: opt.method,
- header: opt.header,
- dataType: 'json',
- success: function (res) {
- opt.success(res);
- },
- fail: function () {
- uni.showToast({
- title: '请稍后重试'
- });
- }
- })
- }
- export {
- requst
- }
|