feat: 请求响应拦截器

This commit is contained in:
2024-12-20 10:35:40 +08:00
parent db5c4b08ff
commit 977f6328f8
19 changed files with 178 additions and 47 deletions

1
.env.development Normal file
View File

@@ -0,0 +1 @@
TARO_APP_API=https://www.baidu.com

1
.env.production Normal file
View File

@@ -0,0 +1 @@
TARO_APP_API=https://www.baidu.com

View File

@@ -39,7 +39,7 @@ export default defineConfig(async (merge, {command, mode}) => {
} }
}, },
cache: { cache: {
enable: true // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache enable: false // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
}, },
mini: { mini: {
postcss: { postcss: {

2
dist/app.js.map vendored
View File

@@ -1 +1 @@
{"version":3,"sources":[""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AAaA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"} {"version":3,"file":"app.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC9BA;AAEA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACrBA;AACA;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AAIA;AAIA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA","sources":["webpack://taro-template/._src_app.jsx","webpack://taro-template/./src/app.jsx?b80d","webpack://taro-template/._src_reducers_counter.js","webpack://taro-template/._src_reducers_index.js","webpack://taro-template/._src_store_index.js"],"sourcesContent":["import { Component } from 'react';\nimport { Provider } from 'react-redux';\nimport configStore from './store';\nimport './app.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst store = configStore();\nclass App extends Component {\n componentDidMount() {}\n componentDidShow() {}\n componentDidHide() {}\n\n // 在 App 类中的 render() 函数没有实际作用\n // 请勿修改此函数\n render() {\n return /*#__PURE__*/_jsx(Provider, {\n store: store,\n children: this.props.children\n });\n }\n}\nexport default App;","import '@tarojs/plugin-platform-weapp/dist/runtime'\nimport '@tarojs/plugin-html/dist/runtime'\n\nimport { window } from '@tarojs/runtime'\nimport { createReactApp } from '@tarojs/plugin-framework-react/dist/runtime'\nimport { initPxTransform } from '@tarojs/taro'\n\nimport component from \"!!../node_modules/.pnpm/@tarojs+taro-loader@4.0.8_webpack@5.91.0_@swc+core@1.3.96_/node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=app!./app.jsx\"\n\nimport * as React from 'react'\nimport ReactDOM from 'react-dom'\n\nvar config = {\"pages\":[\"pages/home/index\",\"pages/index/index\"],\"window\":{\"backgroundTextStyle\":\"light\",\"navigationBarBackgroundColor\":\"#fff\",\"navigationBarTitleText\":\"WeChat\",\"navigationBarTextStyle\":\"black\"},\"lazyCodeLoading\":\"requiredComponents\"};\nwindow.__taroAppConfig = config\nvar inst = App(createReactApp(component, React, ReactDOM, config))\n\ninitPxTransform({\n designWidth: function designWidth(input) {\n var _input_file;\n // 配置 NutUI 375 尺寸\n if ((input === null || input === void 0 ? void 0 : (_input_file = input.file) === null || _input_file === void 0 ? void 0 : _input_file.replace(/\\\\+/g, \"/\").indexOf(\"@nutui\")) > -1) {\n return 375;\n }\n // 全局使用 Taro 默认的 750 尺寸\n return 750;\n },\n deviceRatio: {\"375\":2,\"640\":1.17,\"750\":1,\"828\":0.905},\n baseFontSize: 20,\n unitPrecision: undefined,\n targetUnit: undefined\n})\n","import { ADD, MINUS } from '../constants/counter'\n\nconst INITIAL_STATE = {\n num: 0\n}\n\nexport default function counter (state = INITIAL_STATE, action) {\n switch (action.type) {\n case ADD:\n return {\n ...state,\n num: state.num + 1\n }\n case MINUS:\n return {\n ...state,\n num: state.num - 1\n }\n default:\n return state\n }\n}\n","import { combineReducers } from 'redux'\nimport counter from './counter'\n\nexport default combineReducers({\n counter\n})\n","import { legacy_createStore as createStore, applyMiddleware, compose } from 'redux'\nimport thunkMiddleware from 'redux-thunk'\nimport logger from 'redux-logger'\nimport rootReducer from '../reducers'\n\nconst composeEnhancers = typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\n ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({\n // Specify extensions options like name, actionsBlacklist, actionsCreators, serialize...\n })\n : compose\n\nconst middlewares = [\n thunkMiddleware\n]\n\nif (process.env.NODE_ENV === 'development') {\n middlewares.push(logger)\n}\n\nconst enhancer = composeEnhancers(\n applyMiddleware(...middlewares),\n // other store enhancers if any\n)\n\nexport default function configStore () {\n const store = createStore(rootReducer, enhancer)\n return store\n}\n"],"names":[],"sourceRoot":""}

3
dist/app.wxss vendored
View File

@@ -54,6 +54,9 @@
--tw-contain-paint: ; --tw-contain-paint: ;
--tw-contain-style: --tw-contain-style:
} }
.table {
display: table
}
.text-_red_ { .text-_red_ {
--tw-text-opacity: 1; --tw-text-opacity: 1;
color: rgb(255 0 0 / var(--tw-text-opacity, 1)) color: rgb(255 0 0 / var(--tw-text-opacity, 1))

2
dist/common.js.map vendored
View File

@@ -1 +1 @@
{"version":3,"sources":[""],"names":[],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA"} {"version":3,"file":"common.js","mappings":";;;;;;;;;;;;;AAAA;AACA","sources":["webpack://taro-template/._src_constants_counter.js"],"sourcesContent":["export const ADD = 'ADD'\nexport const MINUS = 'MINUS'\n"],"names":[],"sourceRoot":""}

View File

@@ -8,13 +8,15 @@
"use strict"; "use strict";
/* harmony import */ var _nutui_nutui_react_taro_dist_esm_Button_style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @nutui/nutui-react-taro/dist/esm/Button/style/css */ "./node_modules/.pnpm/@nutui+nutui-react-taro@2.7.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@nutui/nutui-react-taro/dist/esm/Button/style/css.js"); /* harmony import */ var _nutui_nutui_react_taro_dist_esm_Button_style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @nutui/nutui-react-taro/dist/esm/Button/style/css */ "./node_modules/.pnpm/@nutui+nutui-react-taro@2.7.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@nutui/nutui-react-taro/dist/esm/Button/style/css.js");
/* harmony import */ var _nutui_nutui_react_taro_dist_esm_Button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @nutui/nutui-react-taro/dist/esm/Button */ "./node_modules/.pnpm/@nutui+nutui-react-taro@2.7.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@nutui/nutui-react-taro/dist/esm/button.taro-CixO32Hw.js"); /* harmony import */ var _nutui_nutui_react_taro_dist_esm_Button__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @nutui/nutui-react-taro/dist/esm/Button */ "./node_modules/.pnpm/@nutui+nutui-react-taro@2.7.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@nutui/nutui-react-taro/dist/esm/button.taro-CixO32Hw.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/container/remote/react"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/.pnpm/@tarojs+plugin-platform-weapp@4.0.8_@tarojs+service@4.0.8_@tarojs+shared@4.0.8/node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"); /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/.pnpm/@tarojs+plugin-platform-weapp@4.0.8_@tarojs+service@4.0.8_@tarojs+shared@4.0.8/node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../api */ "./src/api/index.js"); /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../api */ "./src/api/index.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime"); /* harmony import */ var _utils_TaroUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/TaroUtils */ "./src/utils/TaroUtils.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
@@ -26,15 +28,22 @@ class Home extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
async sendMsg() { async sendMsg() {
await _api__WEBPACK_IMPORTED_MODULE_2__["default"].system.getBaidu(); await _api__WEBPACK_IMPORTED_MODULE_2__["default"].system.getBaidu();
} }
async showToast() {
_utils_TaroUtils__WEBPACK_IMPORTED_MODULE_3__["default"].showToast("你好");
}
render() { render() {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_4__.View, { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_4__.View, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
class: "text-_red_", class: "text-_red_",
children: "123456" children: "123456"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_nutui_nutui_react_taro_dist_esm_Button__WEBPACK_IMPORTED_MODULE_5__.B, { }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_nutui_nutui_react_taro_dist_esm_Button__WEBPACK_IMPORTED_MODULE_6__.B, {
type: "info", type: "info",
onClick: this.sendMsg, onClick: this.sendMsg,
children: "\u53D1\u9001" children: "\u53D1\u9001"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_nutui_nutui_react_taro_dist_esm_Button__WEBPACK_IMPORTED_MODULE_6__.B, {
type: "info",
onClick: this.showToast,
children: "\u5F39\u7A97"
})] })]
}); });
} }
@@ -568,7 +577,7 @@ const Api = {
const system = { const system = {
getBaidu: async () => { getBaidu: async () => {
return (0,_utils_request__WEBPACK_IMPORTED_MODULE_0__["default"])({ return (0,_utils_request__WEBPACK_IMPORTED_MODULE_0__["default"])({
url: 'https://www.baidu.com/s?wq=你好', url: '/s?wq=你好',
method: 'GET' method: 'GET'
}); });
} }
@@ -604,31 +613,109 @@ var inst = Page(taroOption)
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_pnpm_tarojs_taro_loader_4_0_8_webpack_5_91_0_swc_core_1_3_96_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_home_index_index_jsx__WEBPACK_IMPORTED_MODULE_1__["default"]); /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_pnpm_tarojs_taro_loader_4_0_8_webpack_5_91_0_swc_core_1_3_96_node_modules_tarojs_taro_loader_lib_entry_cache_js_name_pages_home_index_index_jsx__WEBPACK_IMPORTED_MODULE_1__["default"]);
/***/ }),
/***/ "./src/utils/TaroUtils.js":
/*!********************************!*\
!*** ./src/utils/TaroUtils.js ***!
\********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/utils/utils.js");
const TaroUtils = {
showToast(options) {
if (!(0,_utils__WEBPACK_IMPORTED_MODULE_1__.isObject)(options)) {
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
title: options,
duration: 2000
}).then(() => {});
return;
}
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast(options).then(() => {});
}
};
/* harmony default export */ __webpack_exports__["default"] = (TaroUtils);
/***/ }), /***/ }),
/***/ "./src/utils/request.js": /***/ "./src/utils/request.js":
/*!******************************!*\ /*!******************************!*\
!*** ./src/utils/request.js ***! !*** ./src/utils/request.js ***!
\******************************/ \******************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) { /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict"; "use strict";
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
/* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
const request = options => { const request = options => {
const { const {
method, method,
url url,
data
} = options; } = options;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.request({ _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().request({
url: url, url: "https://www.baidu.com" + url,
method: method || 'GET' method: method || 'GET',
success: res => {
resolve(res);
},
fail: err => {
reject(err);
}
}); });
}); });
}; };
const interceptor = function (chain) {
const requestParams = chain.requestParams;
const {
method,
data,
url
} = requestParams;
console.table(Object.entries({
['接口名称']: url,
['请求方式']: method,
['携带参数']: data
}).map(_ref => {
let [key, value] = _ref;
return {
Property: key,
Value: value
};
}));
return chain.proceed(requestParams).then(res => {
console.log(`接口返回:`, res);
return res.data;
});
};
_tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().addInterceptor(interceptor);
/* harmony default export */ __webpack_exports__["default"] = (request); /* harmony default export */ __webpack_exports__["default"] = (request);
/***/ }), /***/ }),
/***/ "./src/utils/utils.js":
/*!****************************!*\
!*** ./src/utils/utils.js ***!
\****************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ isObject: function() { return /* binding */ isObject; }
/* harmony export */ });
const isObject = obj => {
return obj !== null && typeof obj === 'object';
};
/***/ }),
/***/ "./node_modules/.pnpm/@nutui+icons-react-taro@1.0.5/node_modules/@nutui/icons-react-taro/dist/style_icon.css": /***/ "./node_modules/.pnpm/@nutui+icons-react-taro@1.0.5/node_modules/@nutui/icons-react-taro/dist/style_icon.css":
/*!*******************************************************************************************************************!*\ /*!*******************************************************************************************************************!*\
!*** ./node_modules/.pnpm/@nutui+icons-react-taro@1.0.5/node_modules/@nutui/icons-react-taro/dist/style_icon.css ***! !*** ./node_modules/.pnpm/@nutui+icons-react-taro@1.0.5/node_modules/@nutui/icons-react-taro/dist/style_icon.css ***!

View File

@@ -1 +1 @@
{"version":3,"sources":[""],"names":[],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwOA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;AAIA;AACA;AACA;AACA;AACA;;;;AAIA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"} {"version":3,"sources":[""],"names":[],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwOA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;AAIA;AACA;AACA;AACA;AACA;;;;AAIA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}

View File

@@ -1 +1 @@
{"version":3,"sources":[""],"names":[],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;;;AAIA;AACA;AACA;AACA;AACA;;;;AAIA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"} {"version":3,"file":"pages/index/index.js","mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC1DA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://taro-template/._src_pages_index_index.jsx","webpack://taro-template/._src_actions_counter.js","webpack://taro-template/./src/pages/index/index.jsx?e561"],"sourcesContent":["var _dec, _class;\nimport { Component } from 'react';\nimport { connect } from 'react-redux';\nimport { View, Button, Text } from '@tarojs/components';\nimport { add, minus, asyncAdd } from '../../actions/counter';\nimport './index.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nlet Index = (_dec = connect(_ref => {\n let {\n counter\n } = _ref;\n return {\n counter\n };\n}, dispatch => ({\n add() {\n dispatch(add());\n },\n dec() {\n dispatch(minus());\n },\n asyncAdd() {\n dispatch(asyncAdd());\n }\n})), _dec(_class = class Index extends Component {\n componentWillReceiveProps(nextProps) {\n console.log(this.props, nextProps);\n }\n componentWillUnmount() {}\n componentDidShow() {}\n componentDidHide() {}\n render() {\n return /*#__PURE__*/_jsxs(View, {\n className: \"index\",\n children: [/*#__PURE__*/_jsx(Button, {\n className: \"add_btn\",\n onClick: this.props.add,\n children: \"+\"\n }), /*#__PURE__*/_jsx(Button, {\n className: \"dec_btn\",\n onClick: this.props.dec,\n children: \"-\"\n }), /*#__PURE__*/_jsx(Button, {\n className: \"dec_btn\",\n onClick: this.props.asyncAdd,\n children: \"async\"\n }), /*#__PURE__*/_jsx(View, {\n children: /*#__PURE__*/_jsx(Text, {\n children: this.props.counter.num\n })\n }), /*#__PURE__*/_jsx(View, {\n children: /*#__PURE__*/_jsx(Text, {\n children: \"Hello, World\"\n })\n })]\n });\n }\n}) || _class);\nexport default Index;","import {\n ADD,\n MINUS\n} from '../constants/counter'\n\nexport const add = () => {\n return {\n type: ADD\n }\n}\nexport const minus = () => {\n return {\n type: MINUS\n }\n}\n\n// 异步的action\nexport function asyncAdd () {\n return dispatch => {\n setTimeout(() => {\n dispatch(add())\n }, 2000)\n }\n}\n","import { createPageConfig } from '@tarojs/runtime'\nimport component from \"!!../../../node_modules/.pnpm/@tarojs+taro-loader@4.0.8_webpack@5.91.0_@swc+core@1.3.96_/node_modules/@tarojs/taro-loader/lib/entry-cache.js?name=pages/index/index!./index.jsx\"\nvar config = {\"navigationBarTitleText\":\"首页\"};\n\n\n\nvar taroOption = createPageConfig(component, 'pages/index/index', {root:{cn:[]}}, config || {})\nif (component && component.behaviors) {\n taroOption.behaviors = (taroOption.behaviors || []).concat(component.behaviors)\n}\nvar inst = Page(taroOption)\n\n\n\nexport default component\n"],"names":[],"sourceRoot":""}

View File

@@ -15,6 +15,9 @@ var moduleMap = {
"./react-redux": function() { "./react-redux": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-6TBQVUF2_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-TQO5S7WL_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_react-redux_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-redux.js */ "./node_modules/.taro/weapp/prebundle/react-redux.js")); }; }); return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-6TBQVUF2_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-TQO5S7WL_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_react-redux_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-redux.js */ "./node_modules/.taro/weapp/prebundle/react-redux.js")); }; });
}, },
"./@tarojs/taro": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_taro_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_taro.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_taro.js")); }; });
},
"./redux": function() { "./redux": function() {
return __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_redux_js").then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/redux.js */ "./node_modules/.taro/weapp/prebundle/redux.js")); }; }); return __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_redux_js").then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/redux.js */ "./node_modules/.taro/weapp/prebundle/redux.js")); }; });
}, },
@@ -30,17 +33,14 @@ var moduleMap = {
"./@tarojs/runtime": function() { "./@tarojs/runtime": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("node_modules_taro_weapp_prebundle_tarojs_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js")); }; }); return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("node_modules_taro_weapp_prebundle_tarojs_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js")); }; });
}, },
"./@tarojs/plugin-platform-weapp/dist/runtime": function() { "./@tarojs/plugin-framework-react/dist/runtime": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-platform-weapp_dist_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js")); }; }); return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-framework-react_dist_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js")); }; });
}, },
"./@tarojs/plugin-html/dist/runtime": function() { "./@tarojs/plugin-html/dist/runtime": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-html_dist_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js")); }; }); return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-html_dist_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js")); }; });
}, },
"./@tarojs/plugin-framework-react/dist/runtime": function() { "./@tarojs/plugin-platform-weapp/dist/runtime": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-framework-react_dist_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js")); }; }); return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_plugin-platform-weapp_dist_runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js")); }; });
},
"./@tarojs/taro": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_tarojs_taro_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_taro.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_taro.js")); }; });
}, },
"./react-dom": function() { "./react-dom": function() {
return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-6TBQVUF2_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-TQO5S7WL_js"), __webpack_require__.e("node_modules_taro_weapp_prebundle_react-dom_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-dom.js */ "./node_modules/.taro/weapp/prebundle/react-dom.js")); }; }); return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-GLEAZC6U_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-WRSQ3V3E_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-6TBQVUF2_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-TQO5S7WL_js"), __webpack_require__.e("node_modules_taro_weapp_prebundle_react-dom_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-dom.js */ "./node_modules/.taro/weapp/prebundle/react-dom.js")); }; });
@@ -80,6 +80,9 @@ var taroModuleMap = {
"./react-redux": function() { "./react-redux": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-redux.js */ "./node_modules/.taro/weapp/prebundle/react-redux.js")); }; return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-redux.js */ "./node_modules/.taro/weapp/prebundle/react-redux.js")); };
}, },
"./@tarojs/taro": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_taro.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_taro.js")); };
},
"./redux": function() { "./redux": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/redux.js */ "./node_modules/.taro/weapp/prebundle/redux.js")); }; return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/redux.js */ "./node_modules/.taro/weapp/prebundle/redux.js")); };
}, },
@@ -95,17 +98,14 @@ var taroModuleMap = {
"./@tarojs/runtime": function() { "./@tarojs/runtime": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js")); }; return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_runtime.js")); };
}, },
"./@tarojs/plugin-platform-weapp/dist/runtime": function() { "./@tarojs/plugin-framework-react/dist/runtime": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js")); }; return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js")); };
}, },
"./@tarojs/plugin-html/dist/runtime": function() { "./@tarojs/plugin-html/dist/runtime": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js")); }; return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-html_dist_runtime.js")); };
}, },
"./@tarojs/plugin-framework-react/dist/runtime": function() { "./@tarojs/plugin-platform-weapp/dist/runtime": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-framework-react_dist_runtime.js")); }; return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_plugin-platform-weapp_dist_runtime.js")); };
},
"./@tarojs/taro": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/@tarojs_taro.js */ "./node_modules/.taro/weapp/prebundle/@tarojs_taro.js")); };
}, },
"./react-dom": function() { "./react-dom": function() {
return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-dom.js */ "./node_modules/.taro/weapp/prebundle/react-dom.js")); }; return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react-dom.js */ "./node_modules/.taro/weapp/prebundle/react-dom.js")); };

2
dist/runtime.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/taro.js.map vendored
View File

@@ -1 +1 @@
{"version":3,"sources":[""],"names":[],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA"} {"version":3,"file":"taro.js","mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACrCA;AACA;AACA;AACA;;;;;;;;;;;;ACHA;AACA;AACA;AACA","sources":["webpack://taro-template/.._.._taro-components_mini_index.js","webpack://taro-template/.._src_components-react.ts","webpack://taro-template/._node_modules_.pnpm_@tarojs+webpack5-runner@4.0.8_@babel+core@7.26.0_@swc+core@1.3.96_@tarojs+runtime@4.0.8_less@_bde7hlupvtnhjp5wnja2su6pqy_node_modules_@tarojs_webpack5-runner_dist_template_comp.js","webpack://taro-template/._node_modules_.pnpm_@tarojs+webpack5-runner@4.0.8_@babel+core@7.26.0_@swc+core@1.3.96_@tarojs+runtime@4.0.8_less@_bde7hlupvtnhjp5wnja2su6pqy_node_modules_@tarojs_webpack5-runner_dist_template_custom-wrapper.js"],"sourcesContent":["export const View = 'view'\nexport const Icon = 'icon'\nexport const Progress = 'progress'\nexport const RichText = 'rich-text'\nexport const Text = 'text'\nexport const Button = 'button'\nexport const Checkbox = 'checkbox'\nexport const CheckboxGroup = 'checkbox-group'\nexport const Form = 'form'\nexport const Input = 'input'\nexport const Label = 'label'\nexport const Picker = 'picker'\nexport const PickerView = 'picker-view'\nexport const PickerViewColumn = 'picker-view-column'\nexport const Radio = 'radio'\nexport const RadioGroup = 'radio-group'\nexport const Slider = 'slider'\nexport const Switch = 'switch'\nexport const CoverImage = 'cover-image'\nexport const Textarea = 'textarea'\nexport const CoverView = 'cover-view'\nexport const MovableArea = 'movable-area'\nexport const MovableView = 'movable-view'\nexport const ScrollView = 'scroll-view'\nexport const Swiper = 'swiper'\nexport const SwiperItem = 'swiper-item'\nexport const Navigator = 'navigator'\nexport const Audio = 'audio'\nexport const Camera = 'camera'\nexport const Image = 'image'\nexport const LivePlayer = 'live-player'\nexport const Video = 'video'\nexport const Canvas = 'canvas'\nexport const Ad = 'ad'\nexport const WebView = 'web-view'\nexport const Block = 'block'\nexport const Map = 'map'\nexport const Slot = 'slot'\nexport const NativeSlot = 'native-slot'\nexport const CustomWrapper = 'custom-wrapper'\n",null,"/* eslint-disable no-undef */\nimport { createRecursiveComponentConfig } from '@tarojs/runtime'\n// @ts-ignore\nComponent(createRecursiveComponentConfig())\n","/* eslint-disable no-undef */\nimport { createRecursiveComponentConfig } from '@tarojs/runtime'\n// @ts-ignore\nComponent(createRecursiveComponentConfig('custom-wrapper'))\n"],"names":[],"sourceRoot":""}

View File

@@ -85,7 +85,6 @@
"react-refresh": "^0.11.0", "react-refresh": "^0.11.0",
"stylelint": "^14.4.0", "stylelint": "^14.4.0",
"tailwindcss": "^3.4.17", "tailwindcss": "^3.4.17",
"taro-plugin-compiler-optimization": "^1.0.4",
"thread-loader": "^4.0.4", "thread-loader": "^4.0.4",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"weapp-tailwindcss": "^3.7.0", "weapp-tailwindcss": "^3.7.0",

8
pnpm-lock.yaml generated
View File

@@ -147,9 +147,6 @@ importers:
tailwindcss: tailwindcss:
specifier: ^3.4.17 specifier: ^3.4.17
version: 3.4.17(ts-node@10.9.2(@swc/core@1.3.96)(@types/node@18.19.68)(typescript@5.7.2)) version: 3.4.17(ts-node@10.9.2(@swc/core@1.3.96)(@types/node@18.19.68)(typescript@5.7.2))
taro-plugin-compiler-optimization:
specifier: ^1.0.4
version: 1.0.4
thread-loader: thread-loader:
specifier: ^4.0.4 specifier: ^4.0.4
version: 4.0.4(webpack@5.91.0(@swc/core@1.3.96)) version: 4.0.4(webpack@5.91.0(@swc/core@1.3.96))
@@ -6084,9 +6081,6 @@ packages:
resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==} resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==}
engines: {node: '>=18'} engines: {node: '>=18'}
taro-plugin-compiler-optimization@1.0.4:
resolution: {integrity: sha512-7aAOSWLpkPlJkCM6NPjcZEqoLXdquNy16CEEKIzAAD03OJ742rHhVzbZ0NIdMABMV7xC+gzRFq9eoZ64gm9o2g==}
terser-webpack-plugin@5.3.11: terser-webpack-plugin@5.3.11:
resolution: {integrity: sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==} resolution: {integrity: sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==}
engines: {node: '>= 10.13.0'} engines: {node: '>= 10.13.0'}
@@ -13352,8 +13346,6 @@ snapshots:
mkdirp: 3.0.1 mkdirp: 3.0.1
yallist: 5.0.0 yallist: 5.0.0
taro-plugin-compiler-optimization@1.0.4: {}
terser-webpack-plugin@5.3.11(@swc/core@1.3.96)(esbuild@0.21.5)(webpack@5.91.0(@swc/core@1.3.96)): terser-webpack-plugin@5.3.11(@swc/core@1.3.96)(esbuild@0.21.5)(webpack@5.91.0(@swc/core@1.3.96)):
dependencies: dependencies:
'@jridgewell/trace-mapping': 0.3.25 '@jridgewell/trace-mapping': 0.3.25

View File

@@ -3,7 +3,7 @@ import request from '../../utils/request';
const system = { const system = {
getBaidu: async () => { getBaidu: async () => {
return request({ return request({
url: 'https://www.baidu.com/s?wq=你好', url: '/s?wq=你好',
method: 'GET', method: 'GET',
}); });
} }

View File

@@ -4,16 +4,21 @@ import { Button } from '@nutui/nutui-react-taro'
import './index.scss' import './index.scss'
import Api from "../../api"; import Api from "../../api";
import TaroUtils from "../../utils/TaroUtils";
class Home extends Component { class Home extends Component {
async sendMsg() { async sendMsg() {
await Api.system.getBaidu(); await Api.system.getBaidu();
} }
async showToast() {
TaroUtils.showToast("你好");
}
render() { render() {
return ( return (
<View> <View>
<View class='text-[red]'>123456</View> <View class='text-[red]'>123456</View>
<Button type="info" onClick={this.sendMsg}>发送</Button> <Button type="info" onClick={this.sendMsg}>发送</Button>
<Button type="info" onClick={this.showToast}>弹窗</Button>
</View> </View>
) )
} }

17
src/utils/TaroUtils.js Normal file
View File

@@ -0,0 +1,17 @@
import Taro from "@tarojs/taro";
import {isObject} from "./utils";
const TaroUtils = {
showToast(options) {
if (!isObject(options)) {
Taro.showToast({
title: options,
duration: 2000,
}).then(() => {});
return
}
Taro.showToast(options).then(() => {});
}
}
export default TaroUtils;

View File

@@ -1,11 +1,34 @@
import Taro from "@tarojs/taro";
const request = (options) => { const request = (options) => {
const { method, url } = options; const {method, url, data} = options;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.request({ Taro.request({
url: url, url: process.env.TARO_APP_API + url,
method: method || 'GET', method: method || 'GET',
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
}
}); });
}); });
} }
const interceptor = function (chain) {
const requestParams = chain.requestParams
const {method, data, url} = requestParams
console.table(Object.entries({ ['接口名称']: url, ['请求方式']: method, ['携带参数']: data }).map(([key, value]) => ({ Property: key, Value: value })));
return chain.proceed(requestParams)
.then(res => {
console.log(`接口返回:`, res)
return res.data
})
}
Taro.addInterceptor(interceptor);
export default request; export default request;

3
src/utils/utils.js Normal file
View File

@@ -0,0 +1,3 @@
export const isObject = (obj) => {
return obj !== null && typeof obj === 'object';
}