fimoi-tab-bar 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/demo.html ADDED
@@ -0,0 +1 @@
1
+ <!doctype html><meta charset="utf-8"><title>fimoi-tab-bar demo</title><script src="./fimoi-tab-bar.umd.js"></script><link rel="stylesheet" href="./fimoi-tab-bar.css"><script>console.log(fimoi-tab-bar)</script>
@@ -0,0 +1,363 @@
1
+ /******/ (function() { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ // The require scope
4
+ /******/ var __webpack_require__ = {};
5
+ /******/
6
+ /************************************************************************/
7
+ /******/ /* webpack/runtime/define property getters */
8
+ /******/ !function() {
9
+ /******/ // define getter functions for harmony exports
10
+ /******/ __webpack_require__.d = function(exports, definition) {
11
+ /******/ for(var key in definition) {
12
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14
+ /******/ }
15
+ /******/ }
16
+ /******/ };
17
+ /******/ }();
18
+ /******/
19
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
20
+ /******/ !function() {
21
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
22
+ /******/ }();
23
+ /******/
24
+ /******/ /* webpack/runtime/make namespace object */
25
+ /******/ !function() {
26
+ /******/ // define __esModule on exports
27
+ /******/ __webpack_require__.r = function(exports) {
28
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30
+ /******/ }
31
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
32
+ /******/ };
33
+ /******/ }();
34
+ /******/
35
+ /******/ /* webpack/runtime/publicPath */
36
+ /******/ !function() {
37
+ /******/ __webpack_require__.p = "";
38
+ /******/ }();
39
+ /******/
40
+ /************************************************************************/
41
+ var __webpack_exports__ = {};
42
+ // ESM COMPAT FLAG
43
+ __webpack_require__.r(__webpack_exports__);
44
+
45
+ // EXPORTS
46
+ __webpack_require__.d(__webpack_exports__, {
47
+ "default": function() { return /* binding */ entry_lib; }
48
+ });
49
+
50
+ ;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
51
+ /* eslint-disable no-var */
52
+ // This file is imported into lib/wc client bundles.
53
+
54
+ if (typeof window !== 'undefined') {
55
+ var currentScript = window.document.currentScript
56
+ if (false) // removed by dead control flow
57
+ { var getCurrentScript; }
58
+
59
+ var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
60
+ if (src) {
61
+ __webpack_require__.p = src[1] // eslint-disable-line
62
+ }
63
+ }
64
+
65
+ // Indicate to webpack that this file can be concatenated
66
+ /* harmony default export */ var setPublicPath = (null);
67
+
68
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/fimoiTabBar/index.vue?vue&type=template&id=6f870008&scoped=true
69
+ var render = function render() {
70
+ var _vm = this,
71
+ _c = _vm._self._c;
72
+ return _c('div', {
73
+ staticClass: "tabbar",
74
+ style: _vm.barStyle
75
+ }, _vm._l(_vm.tabs, function (item, index) {
76
+ return _c('button', {
77
+ key: item.key || item.link || index,
78
+ staticClass: "tabbar-item",
79
+ class: {
80
+ active: _vm.currentIndex === index
81
+ },
82
+ style: _vm.itemStyle,
83
+ on: {
84
+ "click": function ($event) {
85
+ return _vm.handleSelect(index);
86
+ }
87
+ }
88
+ }, [item.checked || item.unchecked ? [_vm.currentIndex === index && item.checked ? _c('img', {
89
+ staticClass: "icon-image",
90
+ attrs: {
91
+ "src": item.checked
92
+ }
93
+ }) : item.unchecked ? _c('img', {
94
+ staticClass: "icon-image",
95
+ attrs: {
96
+ "src": item.unchecked
97
+ }
98
+ }) : _vm._e()] : [_c('span', {
99
+ staticClass: "icon-text",
100
+ style: _vm.iconTextStyle
101
+ }, [_vm._v(_vm._s(item.icon))])], _c('span', {
102
+ staticClass: "label",
103
+ style: _vm.labelStyle(_vm.currentIndex === index)
104
+ }, [_vm._v(_vm._s(item.name))])], 2);
105
+ }), 0);
106
+ };
107
+ var staticRenderFns = [];
108
+
109
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/fimoiTabBar/index.vue?vue&type=script&lang=js
110
+ /* global uni */
111
+ /* harmony default export */ var fimoiTabBarvue_type_script_lang_js = ({
112
+ name: "fimoi-tab-bar",
113
+ props: {
114
+ tabs: {
115
+ type: Array,
116
+ default: () => []
117
+ },
118
+ activeKey: {
119
+ type: [String, Number],
120
+ default: ""
121
+ },
122
+ activeIndex: {
123
+ type: Number,
124
+ default: 0
125
+ },
126
+ styleConfig: {
127
+ type: Object,
128
+ default: () => ({})
129
+ }
130
+ },
131
+ data() {
132
+ return {
133
+ internalIndex: 0
134
+ };
135
+ },
136
+ computed: {
137
+ currentIndex() {
138
+ if (this.activeKey !== "") {
139
+ const idx = this.tabs.findIndex(item => item.key === this.activeKey || item.link === this.activeKey);
140
+ return idx >= 0 ? idx : this.activeIndex;
141
+ }
142
+ return this.activeIndex !== undefined ? this.activeIndex : this.internalIndex;
143
+ },
144
+ barStyle() {
145
+ const config = this.styleConfig || {};
146
+ const toRpx = val => typeof val === "number" ? `${val}rpx` : val;
147
+ return {
148
+ position: config.position || "fixed",
149
+ left: 0,
150
+ right: 0,
151
+ bottom: 0,
152
+ height: toRpx(config.height) || "128rpx",
153
+ background: config.background || "#ffffff",
154
+ borderTop: toRpx(config.borderTop) || "1rpx solid #eaeaea",
155
+ boxShadow: config.boxShadow || "0 -12rpx 32rpx rgba(0, 0, 0, 0.06)",
156
+ paddingBottom: "env(safe-area-inset-bottom)" // 增加刘海屏适配
157
+ };
158
+ },
159
+ itemStyle() {
160
+ const config = this.styleConfig || {};
161
+ const toRpx = val => typeof val === "number" ? `${val}rpx` : val;
162
+ return {
163
+ color: config.inactiveColor || "#7a7a7a",
164
+ fontSize: toRpx(config.fontSize) || "24rpx"
165
+ };
166
+ },
167
+ iconTextStyle() {
168
+ const config = this.styleConfig || {};
169
+ const toRpx = val => typeof val === "number" ? `${val}rpx` : val;
170
+ return {
171
+ fontSize: toRpx(config.iconSize) || "40rpx"
172
+ };
173
+ }
174
+ },
175
+ methods: {
176
+ handleSelect(index) {
177
+ this.internalIndex = index;
178
+ const item = this.tabs[index];
179
+ if (item.link) {
180
+ // 判断是否是 tabbar 页面,如果是则使用 switchTab,否则用 navigateTo
181
+ // 这里提供一个 prop 或通过逻辑判断
182
+ const isTab = item.isTab || false;
183
+ if (isTab) {
184
+ uni.switchTab({
185
+ url: item.link,
186
+ fail: err => {
187
+ console.error("switchTab failed:", err);
188
+ // 如果 switchTab 失败,尝试 navigateTo
189
+ uni.navigateTo({
190
+ url: item.link
191
+ });
192
+ }
193
+ });
194
+ } else {
195
+ uni.navigateTo({
196
+ url: item.link,
197
+ fail: err => {
198
+ console.error("navigateTo failed:", err);
199
+ // 如果 navigateTo 失败,尝试 switchTab
200
+ uni.switchTab({
201
+ url: item.link
202
+ });
203
+ }
204
+ });
205
+ }
206
+ }
207
+ this.$emit("change", item);
208
+ },
209
+ labelStyle(isActive) {
210
+ return {
211
+ color: isActive ? this.styleConfig.activeColor || "#409eff" : this.styleConfig.inactiveColor || "#7a7a7a",
212
+ fontWeight: isActive ? this.styleConfig.activeWeight || 600 : this.styleConfig.inactiveWeight || 400
213
+ };
214
+ }
215
+ }
216
+ });
217
+ ;// ./src/package/fimoiTabBar/index.vue?vue&type=script&lang=js
218
+ /* harmony default export */ var package_fimoiTabBarvue_type_script_lang_js = (fimoiTabBarvue_type_script_lang_js);
219
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/fimoiTabBar/index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css
220
+ // extracted by mini-css-extract-plugin
221
+
222
+ ;// ./src/package/fimoiTabBar/index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css
223
+
224
+ ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
225
+ /* globals __VUE_SSR_CONTEXT__ */
226
+
227
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
228
+ // This module is a runtime utility for cleaner component module output and will
229
+ // be included in the final webpack user bundle.
230
+
231
+ function normalizeComponent(
232
+ scriptExports,
233
+ render,
234
+ staticRenderFns,
235
+ functionalTemplate,
236
+ injectStyles,
237
+ scopeId,
238
+ moduleIdentifier /* server only */,
239
+ shadowMode /* vue-cli only */
240
+ ) {
241
+ // Vue.extend constructor export interop
242
+ var options =
243
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
244
+
245
+ // render functions
246
+ if (render) {
247
+ options.render = render
248
+ options.staticRenderFns = staticRenderFns
249
+ options._compiled = true
250
+ }
251
+
252
+ // functional template
253
+ if (functionalTemplate) {
254
+ options.functional = true
255
+ }
256
+
257
+ // scopedId
258
+ if (scopeId) {
259
+ options._scopeId = 'data-v-' + scopeId
260
+ }
261
+
262
+ var hook
263
+ if (moduleIdentifier) {
264
+ // server build
265
+ hook = function (context) {
266
+ // 2.3 injection
267
+ context =
268
+ context || // cached call
269
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
270
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
271
+ // 2.2 with runInNewContext: true
272
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
273
+ context = __VUE_SSR_CONTEXT__
274
+ }
275
+ // inject component styles
276
+ if (injectStyles) {
277
+ injectStyles.call(this, context)
278
+ }
279
+ // register component module identifier for async chunk inferrence
280
+ if (context && context._registeredComponents) {
281
+ context._registeredComponents.add(moduleIdentifier)
282
+ }
283
+ }
284
+ // used by ssr in case component is cached and beforeCreate
285
+ // never gets called
286
+ options._ssrRegister = hook
287
+ } else if (injectStyles) {
288
+ hook = shadowMode
289
+ ? function () {
290
+ injectStyles.call(
291
+ this,
292
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
293
+ )
294
+ }
295
+ : injectStyles
296
+ }
297
+
298
+ if (hook) {
299
+ if (options.functional) {
300
+ // for template-only hot-reload because in that case the render fn doesn't
301
+ // go through the normalizer
302
+ options._injectStyles = hook
303
+ // register for functional component in vue file
304
+ var originalRender = options.render
305
+ options.render = function renderWithStyleInjection(h, context) {
306
+ hook.call(context)
307
+ return originalRender(h, context)
308
+ }
309
+ } else {
310
+ // inject component registration as beforeCreate hook
311
+ var existing = options.beforeCreate
312
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
313
+ }
314
+ }
315
+
316
+ return {
317
+ exports: scriptExports,
318
+ options: options
319
+ }
320
+ }
321
+
322
+ ;// ./src/package/fimoiTabBar/index.vue
323
+
324
+
325
+
326
+ ;
327
+
328
+
329
+ /* normalize component */
330
+
331
+ var component = normalizeComponent(
332
+ package_fimoiTabBarvue_type_script_lang_js,
333
+ render,
334
+ staticRenderFns,
335
+ false,
336
+ null,
337
+ "6f870008",
338
+ null
339
+
340
+ )
341
+
342
+ /* harmony default export */ var fimoiTabBar = (component.exports);
343
+ ;// ./src/package/index.js
344
+ // 引入封装好的组件
345
+ const coms = [fimoiTabBar]; // 将来如果有其它组件,都可以写到这个数组里
346
+
347
+ // 批量组件注册
348
+ const install = function (Vue) {
349
+ coms.forEach(com => {
350
+ Vue.component(com.name, com);
351
+ });
352
+ };
353
+ /* harmony default export */ var src_package = (install);
354
+ ;// ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
355
+
356
+
357
+ /* harmony default export */ var entry_lib = (src_package);
358
+
359
+
360
+ module.exports = __webpack_exports__;
361
+ /******/ })()
362
+ ;
363
+ //# sourceMappingURL=fimoi-tab-bar.common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fimoi-tab-bar.common.js","mappings":";;UAAA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,8CAA8C,yD;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;WCNA,2B;;;;;;;;;;;;;;ACAA;AACA;;AAEA;AACA;AACA,MAAM,KAAuC,EAAE;AAAA,yBAQ5C;;AAEH;AACA;AACA,IAAI,qBAAuB;AAC3B;AACA;;AAEA;AACA,kDAAe,IAAI;;;ACtBnB,IAAIA,MAAM,GAAG,SAASA,MAAMA,CAAA,EAAE;EAAC,IAAIC,GAAG,GAAC,IAAI;IAACC,EAAE,GAACD,GAAG,CAACE,KAAK,CAACD,EAAE;EAAC,OAAOA,EAAE,CAAC,KAAK,EAAC;IAACE,WAAW,EAAC,QAAQ;IAACC,KAAK,EAAEJ,GAAG,CAACK;EAAS,CAAC,EAACL,GAAG,CAACM,EAAE,CAAEN,GAAG,CAACO,IAAI,EAAE,UAASC,IAAI,EAACC,KAAK,EAAC;IAAC,OAAOR,EAAE,CAAC,QAAQ,EAAC;MAACS,GAAG,EAACF,IAAI,CAACE,GAAG,IAAIF,IAAI,CAACG,IAAI,IAAIF,KAAK;MAACN,WAAW,EAAC,aAAa;MAACS,KAAK,EAAC;QAAEC,MAAM,EAAEb,GAAG,CAACc,YAAY,KAAKL;MAAM,CAAC;MAACL,KAAK,EAAEJ,GAAG,CAACe,SAAU;MAACC,EAAE,EAAC;QAAC,OAAO,EAAC,SAAAC,CAASC,MAAM,EAAC;UAAC,OAAO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A;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,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AC/F+F;AACvC;AACL;AACnD,CAA6F;;;AAG7F;AACsG;AACtG,gBAAgB,kBAAU;AAC1B,EAAE,0CAAM;AACR,EAAE,MAAM;AACR,EAAE,eAAe;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA,gDAAe,iB;;AClB4C,CAAC;AAC5D,MAAME,IAAI,GAAG,CAAED,WAAW,CAAC,CAAC,CAAC;;AAE7B;AACA,MAAME,OAAO,GAAG,SAAAA,CAAUC,GAAG,EAAE;EAC7BF,IAAI,CAACG,OAAO,CAAEC,GAAG,IAAK;IACpBF,GAAG,CAACG,SAAS,CAACD,GAAG,CAACvD,IAAI,EAAEuD,GAAG,CAAC;EAC9B,CAAC,CAAC;AACJ,CAAC;AAED,gDAAeH,OAAO,E;;ACXE;AACA;AACxB,8CAAe,WAAG;AACI","sources":["webpack://my-app/webpack/bootstrap","webpack://my-app/webpack/runtime/define property getters","webpack://my-app/webpack/runtime/hasOwnProperty shorthand","webpack://my-app/webpack/runtime/make namespace object","webpack://my-app/webpack/runtime/publicPath","webpack://my-app/./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js","webpack://my-app/./src/package/fimoiTabBar/index.vue","webpack://my-app/src/package/fimoiTabBar/index.vue","webpack://my-app/./src/package/fimoiTabBar/index.vue?9bd3","webpack://my-app/./src/package/fimoiTabBar/index.vue?81d2","webpack://my-app/./src/package/fimoiTabBar/index.vue?abbf","webpack://my-app/./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js","webpack://my-app/./src/package/fimoiTabBar/index.vue?9949","webpack://my-app/./src/package/index.js","webpack://my-app/./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"\";","/* eslint-disable no-var */\n// This file is imported into lib/wc client bundles.\n\nif (typeof window !== 'undefined') {\n var currentScript = window.document.currentScript\n if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {\n var getCurrentScript = require('@soda/get-current-script')\n currentScript = getCurrentScript()\n\n // for backward compatibility, because previously we directly included the polyfill\n if (!('currentScript' in document)) {\n Object.defineProperty(document, 'currentScript', { get: getCurrentScript })\n }\n }\n\n var src = currentScript && currentScript.src.match(/(.+\\/)[^/]+\\.js(\\?.*)?$/)\n if (src) {\n __webpack_public_path__ = src[1] // eslint-disable-line\n }\n}\n\n// Indicate to webpack that this file can be concatenated\nexport default null\n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"tabbar\",style:(_vm.barStyle)},_vm._l((_vm.tabs),function(item,index){return _c('button',{key:item.key || item.link || index,staticClass:\"tabbar-item\",class:{ active: _vm.currentIndex === index },style:(_vm.itemStyle),on:{\"click\":function($event){return _vm.handleSelect(index)}}},[(item.checked || item.unchecked)?[(_vm.currentIndex === index && item.checked)?_c('img',{staticClass:\"icon-image\",attrs:{\"src\":item.checked}}):(item.unchecked)?_c('img',{staticClass:\"icon-image\",attrs:{\"src\":item.unchecked}}):_vm._e()]:[_c('span',{staticClass:\"icon-text\",style:(_vm.iconTextStyle)},[_vm._v(_vm._s(item.icon))])],_c('span',{staticClass:\"label\",style:(_vm.labelStyle(_vm.currentIndex === index))},[_vm._v(_vm._s(item.name))])],2)}),0)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\r\n <div class=\"tabbar\" :style=\"barStyle\">\r\n <button v-for=\"(item, index) in tabs\" :key=\"item.key || item.link || index\" class=\"tabbar-item\"\r\n :class=\"{ active: currentIndex === index }\" :style=\"itemStyle\" @click=\"handleSelect(index)\">\r\n <template v-if=\"item.checked || item.unchecked\">\r\n <img v-if=\"currentIndex === index && item.checked\" class=\"icon-image\" :src=\"item.checked\" />\r\n <img v-else-if=\"item.unchecked\" class=\"icon-image\" :src=\"item.unchecked\" />\r\n </template>\r\n <template v-else>\r\n <span class=\"icon-text\" :style=\"iconTextStyle\">{{ item.icon }}</span>\r\n </template>\r\n <span class=\"label\" :style=\"labelStyle(currentIndex === index)\">{{ item.name }}</span>\r\n </button>\r\n </div>\r\n</template>\r\n<script>\r\n/* global uni */\r\nexport default {\r\n name: \"fimoi-tab-bar\",\r\n props: {\r\n tabs: {\r\n type: Array,\r\n default: () => [],\r\n },\r\n activeKey: {\r\n type: [String, Number],\r\n default: \"\",\r\n },\r\n activeIndex: {\r\n type: Number,\r\n default: 0,\r\n },\r\n styleConfig: {\r\n type: Object,\r\n default: () => ({}),\r\n },\r\n },\r\n data() {\r\n return {\r\n internalIndex: 0,\r\n };\r\n },\r\n computed: {\r\n currentIndex() {\r\n if (this.activeKey !== \"\") {\r\n const idx = this.tabs.findIndex(\r\n (item) => item.key === this.activeKey || item.link === this.activeKey,\r\n );\r\n return idx >= 0 ? idx : this.activeIndex;\r\n }\r\n return this.activeIndex !== undefined ? this.activeIndex : this.internalIndex;\r\n },\r\n barStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n position: config.position || \"fixed\",\r\n left: 0,\r\n right: 0,\r\n bottom: 0,\r\n height: toRpx(config.height) || \"128rpx\",\r\n background: config.background || \"#ffffff\",\r\n borderTop: toRpx(config.borderTop) || \"1rpx solid #eaeaea\",\r\n boxShadow: config.boxShadow || \"0 -12rpx 32rpx rgba(0, 0, 0, 0.06)\",\r\n paddingBottom: \"env(safe-area-inset-bottom)\", // 增加刘海屏适配\r\n };\r\n },\r\n itemStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n color: config.inactiveColor || \"#7a7a7a\",\r\n fontSize: toRpx(config.fontSize) || \"24rpx\",\r\n };\r\n },\r\n iconTextStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n fontSize: toRpx(config.iconSize) || \"40rpx\",\r\n };\r\n },\r\n },\r\n methods: {\r\n handleSelect(index) {\r\n this.internalIndex = index;\r\n const item = this.tabs[index];\r\n if (item.link) {\r\n // 判断是否是 tabbar 页面,如果是则使用 switchTab,否则用 navigateTo\r\n // 这里提供一个 prop 或通过逻辑判断\r\n const isTab = item.isTab || false;\r\n if (isTab) {\r\n uni.switchTab({\r\n url: item.link,\r\n fail: (err) => {\r\n console.error(\"switchTab failed:\", err);\r\n // 如果 switchTab 失败,尝试 navigateTo\r\n uni.navigateTo({ url: item.link });\r\n }\r\n });\r\n } else {\r\n uni.navigateTo({\r\n url: item.link,\r\n fail: (err) => {\r\n console.error(\"navigateTo failed:\", err);\r\n // 如果 navigateTo 失败,尝试 switchTab\r\n uni.switchTab({ url: item.link });\r\n }\r\n });\r\n }\r\n }\r\n this.$emit(\"change\", item);\r\n },\r\n labelStyle(isActive) {\r\n return {\r\n color: isActive ? this.styleConfig.activeColor || \"#409eff\" : this.styleConfig.inactiveColor || \"#7a7a7a\",\r\n fontWeight: isActive ? this.styleConfig.activeWeight || 600 : this.styleConfig.inactiveWeight || 400,\r\n };\r\n },\r\n },\r\n};\r\n</script>\r\n<style scoped>\r\n.tabbar {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-around;\r\n}\r\n\r\n.tabbar-item {\r\n flex: 1;\r\n height: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n gap: 8rpx;\r\n border: none;\r\n background: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.icon-text {\r\n line-height: 1;\r\n}\r\n\r\n.icon-image {\r\n width: 40rpx;\r\n height: 40rpx;\r\n object-fit: contain;\r\n}\r\n</style>\r\n","import mod from \"-!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=script&lang=js\"","// extracted by mini-css-extract-plugin\nexport {};","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!../../../node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css\"","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent(\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier /* server only */,\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options =\n typeof scriptExports === 'function' ? scriptExports.options : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) {\n // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection(h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing ? [].concat(existing, hook) : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","import { render, staticRenderFns } from \"./index.vue?vue&type=template&id=6f870008&scoped=true\"\nimport script from \"./index.vue?vue&type=script&lang=js\"\nexport * from \"./index.vue?vue&type=script&lang=js\"\nimport style0 from \"./index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"6f870008\",\n null\n \n)\n\nexport default component.exports","\r\nimport FimoiTabBar from \"../package/fimoiTabBar/index.vue\"; // 引入封装好的组件\r\nconst coms = [ FimoiTabBar]; // 将来如果有其它组件,都可以写到这个数组里\r\n\r\n// 批量组件注册\r\nconst install = function (Vue) {\r\n coms.forEach((com) => {\r\n Vue.component(com.name, com);\r\n });\r\n};\r\n\r\nexport default install;","import './setPublicPath'\nimport mod from '~entry'\nexport default mod\nexport * from '~entry'\n"],"names":["render","_vm","_c","_self","staticClass","style","barStyle","_l","tabs","item","index","key","link","class","active","currentIndex","itemStyle","on","click","$event","handleSelect","checked","unchecked","attrs","_e","iconTextStyle","_v","_s","icon","labelStyle","name","staticRenderFns","props","type","Array","default","activeKey","String","Number","activeIndex","styleConfig","Object","data","internalIndex","computed","idx","findIndex","undefined","config","toRpx","val","position","left","right","bottom","height","background","borderTop","boxShadow","paddingBottom","color","inactiveColor","fontSize","iconSize","methods","isTab","uni","switchTab","url","fail","err","console","error","navigateTo","$emit","isActive","activeColor","fontWeight","activeWeight","inactiveWeight","FimoiTabBar","coms","install","Vue","forEach","com","component"],"sourceRoot":""}
@@ -0,0 +1 @@
1
+ .tabbar[data-v-6f870008]{display:flex;align-items:center;justify-content:space-around}.tabbar-item[data-v-6f870008]{flex:1;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8rpx;border:none;background:transparent;cursor:pointer}.icon-text[data-v-6f870008]{line-height:1}.icon-image[data-v-6f870008]{width:40rpx;height:40rpx;-o-object-fit:contain;object-fit:contain}
@@ -0,0 +1,374 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["fimoi-tab-bar"] = factory();
8
+ else
9
+ root["fimoi-tab-bar"] = factory();
10
+ })((typeof self !== 'undefined' ? self : this), function() {
11
+ return /******/ (function() { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ // The require scope
14
+ /******/ var __webpack_require__ = {};
15
+ /******/
16
+ /************************************************************************/
17
+ /******/ /* webpack/runtime/define property getters */
18
+ /******/ !function() {
19
+ /******/ // define getter functions for harmony exports
20
+ /******/ __webpack_require__.d = function(exports, definition) {
21
+ /******/ for(var key in definition) {
22
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
23
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
24
+ /******/ }
25
+ /******/ }
26
+ /******/ };
27
+ /******/ }();
28
+ /******/
29
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
30
+ /******/ !function() {
31
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
32
+ /******/ }();
33
+ /******/
34
+ /******/ /* webpack/runtime/make namespace object */
35
+ /******/ !function() {
36
+ /******/ // define __esModule on exports
37
+ /******/ __webpack_require__.r = function(exports) {
38
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
39
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+ /******/ }
41
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
42
+ /******/ };
43
+ /******/ }();
44
+ /******/
45
+ /******/ /* webpack/runtime/publicPath */
46
+ /******/ !function() {
47
+ /******/ __webpack_require__.p = "";
48
+ /******/ }();
49
+ /******/
50
+ /************************************************************************/
51
+ var __webpack_exports__ = {};
52
+ // ESM COMPAT FLAG
53
+ __webpack_require__.r(__webpack_exports__);
54
+
55
+ // EXPORTS
56
+ __webpack_require__.d(__webpack_exports__, {
57
+ "default": function() { return /* binding */ entry_lib; }
58
+ });
59
+
60
+ ;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
61
+ /* eslint-disable no-var */
62
+ // This file is imported into lib/wc client bundles.
63
+
64
+ if (typeof window !== 'undefined') {
65
+ var currentScript = window.document.currentScript
66
+ if (false) // removed by dead control flow
67
+ { var getCurrentScript; }
68
+
69
+ var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
70
+ if (src) {
71
+ __webpack_require__.p = src[1] // eslint-disable-line
72
+ }
73
+ }
74
+
75
+ // Indicate to webpack that this file can be concatenated
76
+ /* harmony default export */ var setPublicPath = (null);
77
+
78
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/fimoiTabBar/index.vue?vue&type=template&id=6f870008&scoped=true
79
+ var render = function render() {
80
+ var _vm = this,
81
+ _c = _vm._self._c;
82
+ return _c('div', {
83
+ staticClass: "tabbar",
84
+ style: _vm.barStyle
85
+ }, _vm._l(_vm.tabs, function (item, index) {
86
+ return _c('button', {
87
+ key: item.key || item.link || index,
88
+ staticClass: "tabbar-item",
89
+ class: {
90
+ active: _vm.currentIndex === index
91
+ },
92
+ style: _vm.itemStyle,
93
+ on: {
94
+ "click": function ($event) {
95
+ return _vm.handleSelect(index);
96
+ }
97
+ }
98
+ }, [item.checked || item.unchecked ? [_vm.currentIndex === index && item.checked ? _c('img', {
99
+ staticClass: "icon-image",
100
+ attrs: {
101
+ "src": item.checked
102
+ }
103
+ }) : item.unchecked ? _c('img', {
104
+ staticClass: "icon-image",
105
+ attrs: {
106
+ "src": item.unchecked
107
+ }
108
+ }) : _vm._e()] : [_c('span', {
109
+ staticClass: "icon-text",
110
+ style: _vm.iconTextStyle
111
+ }, [_vm._v(_vm._s(item.icon))])], _c('span', {
112
+ staticClass: "label",
113
+ style: _vm.labelStyle(_vm.currentIndex === index)
114
+ }, [_vm._v(_vm._s(item.name))])], 2);
115
+ }), 0);
116
+ };
117
+ var staticRenderFns = [];
118
+
119
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/fimoiTabBar/index.vue?vue&type=script&lang=js
120
+ /* global uni */
121
+ /* harmony default export */ var fimoiTabBarvue_type_script_lang_js = ({
122
+ name: "fimoi-tab-bar",
123
+ props: {
124
+ tabs: {
125
+ type: Array,
126
+ default: () => []
127
+ },
128
+ activeKey: {
129
+ type: [String, Number],
130
+ default: ""
131
+ },
132
+ activeIndex: {
133
+ type: Number,
134
+ default: 0
135
+ },
136
+ styleConfig: {
137
+ type: Object,
138
+ default: () => ({})
139
+ }
140
+ },
141
+ data() {
142
+ return {
143
+ internalIndex: 0
144
+ };
145
+ },
146
+ computed: {
147
+ currentIndex() {
148
+ if (this.activeKey !== "") {
149
+ const idx = this.tabs.findIndex(item => item.key === this.activeKey || item.link === this.activeKey);
150
+ return idx >= 0 ? idx : this.activeIndex;
151
+ }
152
+ return this.activeIndex !== undefined ? this.activeIndex : this.internalIndex;
153
+ },
154
+ barStyle() {
155
+ const config = this.styleConfig || {};
156
+ const toRpx = val => typeof val === "number" ? `${val}rpx` : val;
157
+ return {
158
+ position: config.position || "fixed",
159
+ left: 0,
160
+ right: 0,
161
+ bottom: 0,
162
+ height: toRpx(config.height) || "128rpx",
163
+ background: config.background || "#ffffff",
164
+ borderTop: toRpx(config.borderTop) || "1rpx solid #eaeaea",
165
+ boxShadow: config.boxShadow || "0 -12rpx 32rpx rgba(0, 0, 0, 0.06)",
166
+ paddingBottom: "env(safe-area-inset-bottom)" // 增加刘海屏适配
167
+ };
168
+ },
169
+ itemStyle() {
170
+ const config = this.styleConfig || {};
171
+ const toRpx = val => typeof val === "number" ? `${val}rpx` : val;
172
+ return {
173
+ color: config.inactiveColor || "#7a7a7a",
174
+ fontSize: toRpx(config.fontSize) || "24rpx"
175
+ };
176
+ },
177
+ iconTextStyle() {
178
+ const config = this.styleConfig || {};
179
+ const toRpx = val => typeof val === "number" ? `${val}rpx` : val;
180
+ return {
181
+ fontSize: toRpx(config.iconSize) || "40rpx"
182
+ };
183
+ }
184
+ },
185
+ methods: {
186
+ handleSelect(index) {
187
+ this.internalIndex = index;
188
+ const item = this.tabs[index];
189
+ if (item.link) {
190
+ // 判断是否是 tabbar 页面,如果是则使用 switchTab,否则用 navigateTo
191
+ // 这里提供一个 prop 或通过逻辑判断
192
+ const isTab = item.isTab || false;
193
+ if (isTab) {
194
+ uni.switchTab({
195
+ url: item.link,
196
+ fail: err => {
197
+ console.error("switchTab failed:", err);
198
+ // 如果 switchTab 失败,尝试 navigateTo
199
+ uni.navigateTo({
200
+ url: item.link
201
+ });
202
+ }
203
+ });
204
+ } else {
205
+ uni.navigateTo({
206
+ url: item.link,
207
+ fail: err => {
208
+ console.error("navigateTo failed:", err);
209
+ // 如果 navigateTo 失败,尝试 switchTab
210
+ uni.switchTab({
211
+ url: item.link
212
+ });
213
+ }
214
+ });
215
+ }
216
+ }
217
+ this.$emit("change", item);
218
+ },
219
+ labelStyle(isActive) {
220
+ return {
221
+ color: isActive ? this.styleConfig.activeColor || "#409eff" : this.styleConfig.inactiveColor || "#7a7a7a",
222
+ fontWeight: isActive ? this.styleConfig.activeWeight || 600 : this.styleConfig.inactiveWeight || 400
223
+ };
224
+ }
225
+ }
226
+ });
227
+ ;// ./src/package/fimoiTabBar/index.vue?vue&type=script&lang=js
228
+ /* harmony default export */ var package_fimoiTabBarvue_type_script_lang_js = (fimoiTabBarvue_type_script_lang_js);
229
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/fimoiTabBar/index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css
230
+ // extracted by mini-css-extract-plugin
231
+
232
+ ;// ./src/package/fimoiTabBar/index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css
233
+
234
+ ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
235
+ /* globals __VUE_SSR_CONTEXT__ */
236
+
237
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
238
+ // This module is a runtime utility for cleaner component module output and will
239
+ // be included in the final webpack user bundle.
240
+
241
+ function normalizeComponent(
242
+ scriptExports,
243
+ render,
244
+ staticRenderFns,
245
+ functionalTemplate,
246
+ injectStyles,
247
+ scopeId,
248
+ moduleIdentifier /* server only */,
249
+ shadowMode /* vue-cli only */
250
+ ) {
251
+ // Vue.extend constructor export interop
252
+ var options =
253
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
254
+
255
+ // render functions
256
+ if (render) {
257
+ options.render = render
258
+ options.staticRenderFns = staticRenderFns
259
+ options._compiled = true
260
+ }
261
+
262
+ // functional template
263
+ if (functionalTemplate) {
264
+ options.functional = true
265
+ }
266
+
267
+ // scopedId
268
+ if (scopeId) {
269
+ options._scopeId = 'data-v-' + scopeId
270
+ }
271
+
272
+ var hook
273
+ if (moduleIdentifier) {
274
+ // server build
275
+ hook = function (context) {
276
+ // 2.3 injection
277
+ context =
278
+ context || // cached call
279
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
280
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
281
+ // 2.2 with runInNewContext: true
282
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
283
+ context = __VUE_SSR_CONTEXT__
284
+ }
285
+ // inject component styles
286
+ if (injectStyles) {
287
+ injectStyles.call(this, context)
288
+ }
289
+ // register component module identifier for async chunk inferrence
290
+ if (context && context._registeredComponents) {
291
+ context._registeredComponents.add(moduleIdentifier)
292
+ }
293
+ }
294
+ // used by ssr in case component is cached and beforeCreate
295
+ // never gets called
296
+ options._ssrRegister = hook
297
+ } else if (injectStyles) {
298
+ hook = shadowMode
299
+ ? function () {
300
+ injectStyles.call(
301
+ this,
302
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
303
+ )
304
+ }
305
+ : injectStyles
306
+ }
307
+
308
+ if (hook) {
309
+ if (options.functional) {
310
+ // for template-only hot-reload because in that case the render fn doesn't
311
+ // go through the normalizer
312
+ options._injectStyles = hook
313
+ // register for functional component in vue file
314
+ var originalRender = options.render
315
+ options.render = function renderWithStyleInjection(h, context) {
316
+ hook.call(context)
317
+ return originalRender(h, context)
318
+ }
319
+ } else {
320
+ // inject component registration as beforeCreate hook
321
+ var existing = options.beforeCreate
322
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
323
+ }
324
+ }
325
+
326
+ return {
327
+ exports: scriptExports,
328
+ options: options
329
+ }
330
+ }
331
+
332
+ ;// ./src/package/fimoiTabBar/index.vue
333
+
334
+
335
+
336
+ ;
337
+
338
+
339
+ /* normalize component */
340
+
341
+ var component = normalizeComponent(
342
+ package_fimoiTabBarvue_type_script_lang_js,
343
+ render,
344
+ staticRenderFns,
345
+ false,
346
+ null,
347
+ "6f870008",
348
+ null
349
+
350
+ )
351
+
352
+ /* harmony default export */ var fimoiTabBar = (component.exports);
353
+ ;// ./src/package/index.js
354
+ // 引入封装好的组件
355
+ const coms = [fimoiTabBar]; // 将来如果有其它组件,都可以写到这个数组里
356
+
357
+ // 批量组件注册
358
+ const install = function (Vue) {
359
+ coms.forEach(com => {
360
+ Vue.component(com.name, com);
361
+ });
362
+ };
363
+ /* harmony default export */ var src_package = (install);
364
+ ;// ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
365
+
366
+
367
+ /* harmony default export */ var entry_lib = (src_package);
368
+
369
+
370
+ /******/ return __webpack_exports__;
371
+ /******/ })()
372
+ ;
373
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AC/F+F;AACvC;AACL;AACnD,CAA6F;;;AAG7F;AACsG;AACtG,gBAAgB,kBAAU;AAC1B,EAAE,0CAAM;AACR,EAAE,MAAM;AACR,EAAE,eAAe;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA,gDAAe,iB;;AClB4C,CAAC;AAC5D,MAAME,IAAI,GAAG,CAAED,WAAW,CAAC,CAAC,CAAC;;AAE7B;AACA,MAAME,OAAO,GAAG,SAAAA,CAAUC,GAAG,EAAE;EAC7BF,IAAI,CAACG,OAAO,CAAEC,GAAG,IAAK;IACpBF,GAAG,CAACG,SAAS,CAACD,GAAG,CAACvD,IAAI,EAAEuD,GAAG,CAAC;EAC9B,CAAC,CAAC;AACJ,CAAC;AAED,gDAAeH,OAAO,E;;ACXE;AACA;AACxB,8CAAe,WAAG;AACI","sources":["webpack://fimoi-tab-bar/webpack/universalModuleDefinition","webpack://fimoi-tab-bar/webpack/bootstrap","webpack://fimoi-tab-bar/webpack/runtime/define property getters","webpack://fimoi-tab-bar/webpack/runtime/hasOwnProperty shorthand","webpack://fimoi-tab-bar/webpack/runtime/make namespace object","webpack://fimoi-tab-bar/webpack/runtime/publicPath","webpack://fimoi-tab-bar/./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue","webpack://fimoi-tab-bar/src/package/fimoiTabBar/index.vue","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue?7614","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue?8729","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue?0dcf","webpack://fimoi-tab-bar/./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue?9949","webpack://fimoi-tab-bar/./src/package/index.js","webpack://fimoi-tab-bar/./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"fimoi-tab-bar\"] = factory();\n\telse\n\t\troot[\"fimoi-tab-bar\"] = factory();\n})((typeof self !== 'undefined' ? self : this), function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"\";","/* eslint-disable no-var */\n// This file is imported into lib/wc client bundles.\n\nif (typeof window !== 'undefined') {\n var currentScript = window.document.currentScript\n if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {\n var getCurrentScript = require('@soda/get-current-script')\n currentScript = getCurrentScript()\n\n // for backward compatibility, because previously we directly included the polyfill\n if (!('currentScript' in document)) {\n Object.defineProperty(document, 'currentScript', { get: getCurrentScript })\n }\n }\n\n var src = currentScript && currentScript.src.match(/(.+\\/)[^/]+\\.js(\\?.*)?$/)\n if (src) {\n __webpack_public_path__ = src[1] // eslint-disable-line\n }\n}\n\n// Indicate to webpack that this file can be concatenated\nexport default null\n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"tabbar\",style:(_vm.barStyle)},_vm._l((_vm.tabs),function(item,index){return _c('button',{key:item.key || item.link || index,staticClass:\"tabbar-item\",class:{ active: _vm.currentIndex === index },style:(_vm.itemStyle),on:{\"click\":function($event){return _vm.handleSelect(index)}}},[(item.checked || item.unchecked)?[(_vm.currentIndex === index && item.checked)?_c('img',{staticClass:\"icon-image\",attrs:{\"src\":item.checked}}):(item.unchecked)?_c('img',{staticClass:\"icon-image\",attrs:{\"src\":item.unchecked}}):_vm._e()]:[_c('span',{staticClass:\"icon-text\",style:(_vm.iconTextStyle)},[_vm._v(_vm._s(item.icon))])],_c('span',{staticClass:\"label\",style:(_vm.labelStyle(_vm.currentIndex === index))},[_vm._v(_vm._s(item.name))])],2)}),0)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\r\n <div class=\"tabbar\" :style=\"barStyle\">\r\n <button v-for=\"(item, index) in tabs\" :key=\"item.key || item.link || index\" class=\"tabbar-item\"\r\n :class=\"{ active: currentIndex === index }\" :style=\"itemStyle\" @click=\"handleSelect(index)\">\r\n <template v-if=\"item.checked || item.unchecked\">\r\n <img v-if=\"currentIndex === index && item.checked\" class=\"icon-image\" :src=\"item.checked\" />\r\n <img v-else-if=\"item.unchecked\" class=\"icon-image\" :src=\"item.unchecked\" />\r\n </template>\r\n <template v-else>\r\n <span class=\"icon-text\" :style=\"iconTextStyle\">{{ item.icon }}</span>\r\n </template>\r\n <span class=\"label\" :style=\"labelStyle(currentIndex === index)\">{{ item.name }}</span>\r\n </button>\r\n </div>\r\n</template>\r\n<script>\r\n/* global uni */\r\nexport default {\r\n name: \"fimoi-tab-bar\",\r\n props: {\r\n tabs: {\r\n type: Array,\r\n default: () => [],\r\n },\r\n activeKey: {\r\n type: [String, Number],\r\n default: \"\",\r\n },\r\n activeIndex: {\r\n type: Number,\r\n default: 0,\r\n },\r\n styleConfig: {\r\n type: Object,\r\n default: () => ({}),\r\n },\r\n },\r\n data() {\r\n return {\r\n internalIndex: 0,\r\n };\r\n },\r\n computed: {\r\n currentIndex() {\r\n if (this.activeKey !== \"\") {\r\n const idx = this.tabs.findIndex(\r\n (item) => item.key === this.activeKey || item.link === this.activeKey,\r\n );\r\n return idx >= 0 ? idx : this.activeIndex;\r\n }\r\n return this.activeIndex !== undefined ? this.activeIndex : this.internalIndex;\r\n },\r\n barStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n position: config.position || \"fixed\",\r\n left: 0,\r\n right: 0,\r\n bottom: 0,\r\n height: toRpx(config.height) || \"128rpx\",\r\n background: config.background || \"#ffffff\",\r\n borderTop: toRpx(config.borderTop) || \"1rpx solid #eaeaea\",\r\n boxShadow: config.boxShadow || \"0 -12rpx 32rpx rgba(0, 0, 0, 0.06)\",\r\n paddingBottom: \"env(safe-area-inset-bottom)\", // 增加刘海屏适配\r\n };\r\n },\r\n itemStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n color: config.inactiveColor || \"#7a7a7a\",\r\n fontSize: toRpx(config.fontSize) || \"24rpx\",\r\n };\r\n },\r\n iconTextStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n fontSize: toRpx(config.iconSize) || \"40rpx\",\r\n };\r\n },\r\n },\r\n methods: {\r\n handleSelect(index) {\r\n this.internalIndex = index;\r\n const item = this.tabs[index];\r\n if (item.link) {\r\n // 判断是否是 tabbar 页面,如果是则使用 switchTab,否则用 navigateTo\r\n // 这里提供一个 prop 或通过逻辑判断\r\n const isTab = item.isTab || false;\r\n if (isTab) {\r\n uni.switchTab({\r\n url: item.link,\r\n fail: (err) => {\r\n console.error(\"switchTab failed:\", err);\r\n // 如果 switchTab 失败,尝试 navigateTo\r\n uni.navigateTo({ url: item.link });\r\n }\r\n });\r\n } else {\r\n uni.navigateTo({\r\n url: item.link,\r\n fail: (err) => {\r\n console.error(\"navigateTo failed:\", err);\r\n // 如果 navigateTo 失败,尝试 switchTab\r\n uni.switchTab({ url: item.link });\r\n }\r\n });\r\n }\r\n }\r\n this.$emit(\"change\", item);\r\n },\r\n labelStyle(isActive) {\r\n return {\r\n color: isActive ? this.styleConfig.activeColor || \"#409eff\" : this.styleConfig.inactiveColor || \"#7a7a7a\",\r\n fontWeight: isActive ? this.styleConfig.activeWeight || 600 : this.styleConfig.inactiveWeight || 400,\r\n };\r\n },\r\n },\r\n};\r\n</script>\r\n<style scoped>\r\n.tabbar {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-around;\r\n}\r\n\r\n.tabbar-item {\r\n flex: 1;\r\n height: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n gap: 8rpx;\r\n border: none;\r\n background: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.icon-text {\r\n line-height: 1;\r\n}\r\n\r\n.icon-image {\r\n width: 40rpx;\r\n height: 40rpx;\r\n object-fit: contain;\r\n}\r\n</style>\r\n","import mod from \"-!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=script&lang=js\"","// extracted by mini-css-extract-plugin\nexport {};","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!../../../node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css\"","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent(\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier /* server only */,\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options =\n typeof scriptExports === 'function' ? scriptExports.options : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) {\n // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection(h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing ? [].concat(existing, hook) : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","import { render, staticRenderFns } from \"./index.vue?vue&type=template&id=6f870008&scoped=true\"\nimport script from \"./index.vue?vue&type=script&lang=js\"\nexport * from \"./index.vue?vue&type=script&lang=js\"\nimport style0 from \"./index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"6f870008\",\n null\n \n)\n\nexport default component.exports","\r\nimport FimoiTabBar from \"../package/fimoiTabBar/index.vue\"; // 引入封装好的组件\r\nconst coms = [ FimoiTabBar]; // 将来如果有其它组件,都可以写到这个数组里\r\n\r\n// 批量组件注册\r\nconst install = function (Vue) {\r\n coms.forEach((com) => {\r\n Vue.component(com.name, com);\r\n });\r\n};\r\n\r\nexport default install;","import './setPublicPath'\nimport mod from '~entry'\nexport default mod\nexport * from '~entry'\n"],"names":["render","_vm","_c","_self","staticClass","style","barStyle","_l","tabs","item","index","key","link","class","active","currentIndex","itemStyle","on","click","$event","handleSelect","checked","unchecked","attrs","_e","iconTextStyle","_v","_s","icon","labelStyle","name","staticRenderFns","props","type","Array","default","activeKey","String","Number","activeIndex","styleConfig","Object","data","internalIndex","computed","idx","findIndex","undefined","config","toRpx","val","position","left","right","bottom","height","background","borderTop","boxShadow","paddingBottom","color","inactiveColor","fontSize","iconSize","methods","isTab","uni","switchTab","url","fail","err","console","error","navigateTo","$emit","isActive","activeColor","fontWeight","activeWeight","inactiveWeight","FimoiTabBar","coms","install","Vue","forEach","com","component"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["fimoi-tab-bar"]=t():e["fimoi-tab-bar"]=t()})("undefined"!==typeof self?self:this,function(){return function(){"use strict";var e={};!function(){e.d=function(t,n){for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})}}(),function(){e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){e.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){e.p=""}();var t={};if(e.r(t),e.d(t,{default:function(){return h}}),"undefined"!==typeof window){var n=window.document.currentScript,i=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(e.p=i[1])}var o=function(){var e=this,t=e._self._c;return t("div",{staticClass:"tabbar",style:e.barStyle},e._l(e.tabs,function(n,i){return t("button",{key:n.key||n.link||i,staticClass:"tabbar-item",class:{active:e.currentIndex===i},style:e.itemStyle,on:{click:function(t){return e.handleSelect(i)}}},[n.checked||n.unchecked?[e.currentIndex===i&&n.checked?t("img",{staticClass:"icon-image",attrs:{src:n.checked}}):n.unchecked?t("img",{staticClass:"icon-image",attrs:{src:n.unchecked}}):e._e()]:[t("span",{staticClass:"icon-text",style:e.iconTextStyle},[e._v(e._s(n.icon))])],t("span",{staticClass:"label",style:e.labelStyle(e.currentIndex===i)},[e._v(e._s(n.name))])],2)}),0)},r=[],a={name:"fimoi-tab-bar",props:{tabs:{type:Array,default:()=>[]},activeKey:{type:[String,Number],default:""},activeIndex:{type:Number,default:0},styleConfig:{type:Object,default:()=>({})}},data(){return{internalIndex:0}},computed:{currentIndex(){if(""!==this.activeKey){const e=this.tabs.findIndex(e=>e.key===this.activeKey||e.link===this.activeKey);return e>=0?e:this.activeIndex}return void 0!==this.activeIndex?this.activeIndex:this.internalIndex},barStyle(){const e=this.styleConfig||{},t=e=>"number"===typeof e?`${e}rpx`:e;return{position:e.position||"fixed",left:0,right:0,bottom:0,height:t(e.height)||"128rpx",background:e.background||"#ffffff",borderTop:t(e.borderTop)||"1rpx solid #eaeaea",boxShadow:e.boxShadow||"0 -12rpx 32rpx rgba(0, 0, 0, 0.06)",paddingBottom:"env(safe-area-inset-bottom)"}},itemStyle(){const e=this.styleConfig||{},t=e=>"number"===typeof e?`${e}rpx`:e;return{color:e.inactiveColor||"#7a7a7a",fontSize:t(e.fontSize)||"24rpx"}},iconTextStyle(){const e=this.styleConfig||{},t=e=>"number"===typeof e?`${e}rpx`:e;return{fontSize:t(e.iconSize)||"40rpx"}}},methods:{handleSelect(e){this.internalIndex=e;const t=this.tabs[e];if(t.link){const e=t.isTab||!1;e?uni.switchTab({url:t.link,fail:e=>{console.error("switchTab failed:",e),uni.navigateTo({url:t.link})}}):uni.navigateTo({url:t.link,fail:e=>{console.error("navigateTo failed:",e),uni.switchTab({url:t.link})}})}this.$emit("change",t)},labelStyle(e){return{color:e?this.styleConfig.activeColor||"#409eff":this.styleConfig.inactiveColor||"#7a7a7a",fontWeight:e?this.styleConfig.activeWeight||600:this.styleConfig.inactiveWeight||400}}}},s=a;function c(e,t,n,i,o,r,a,s){var c,l="function"===typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),i&&(l.functional=!0),r&&(l._scopeId="data-v-"+r),a?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=c):o&&(c=s?function(){o.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(l.functional){l._injectStyles=c;var f=l.render;l.render=function(e,t){return c.call(t),f(e,t)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,c):[c]}return{exports:e,options:l}}var l=c(s,o,r,!1,null,"6f870008",null),f=l.exports;const u=[f],d=function(e){u.forEach(t=>{e.component(t.name,t)})};var p=d,h=p;return t}()});
2
+ //# sourceMappingURL=fimoi-tab-bar.umd.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fimoi-tab-bar.umd.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,kBAAZC,SAA0C,kBAAXC,OACxCA,OAAOD,QAAUD,IACQ,oBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,kBAAZC,QACdA,QAAQ,iBAAmBD,IAE3BD,EAAK,iBAAmBC,GACzB,EATD,CASoB,qBAATK,KAAuBA,KAAOC,KAAO,WAChD,O,wBCTA,IAAIC,EAAsB,CAAC,G,WCA3BA,EAAoBC,EAAI,SAASP,EAASQ,GACzC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEV,EAASS,IAC5EE,OAAOC,eAAeZ,EAASS,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAG3E,C,eCPAH,EAAoBI,EAAI,SAASK,EAAKC,GAAQ,OAAOL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,EAAO,C,eCCtGV,EAAoBc,EAAI,SAASpB,GACX,qBAAXqB,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAeZ,EAASqB,OAAOC,YAAa,CAAEC,MAAO,WAE7DZ,OAAOC,eAAeZ,EAAS,aAAc,CAAEuB,OAAO,GACvD,C,eCNAjB,EAAoBkB,EAAI,E,aCGxB,G,6CAAsB,qBAAXC,OAAwB,CACjC,IAAIC,EAAgBD,OAAOE,SAASD,cAWhCE,EAAMF,GAAiBA,EAAcE,IAAIC,MAAM,2BAC/CD,IACF,IAA0BA,EAAI,GAElC,CAGA,ICtBIE,EAAS,WAAkB,IAAIC,EAAI1B,KAAK2B,EAAGD,EAAIE,MAAMD,GAAG,OAAOA,EAAG,MAAM,C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ACA,EACA,KACA,WACA,MAIF,EAAe6E,E,QCjBf,MAAMC,EAAO,CAAEC,GAGTC,EAAU,SAAUC,GACxBH,EAAKI,QAASC,IACZF,EAAIJ,UAAUM,EAAIpF,KAAMoF,IAE5B,EAEA,QCTA,I","sources":["webpack://fimoi-tab-bar/webpack/universalModuleDefinition","webpack://fimoi-tab-bar/webpack/bootstrap","webpack://fimoi-tab-bar/webpack/runtime/define property getters","webpack://fimoi-tab-bar/webpack/runtime/hasOwnProperty shorthand","webpack://fimoi-tab-bar/webpack/runtime/make namespace object","webpack://fimoi-tab-bar/webpack/runtime/publicPath","webpack://fimoi-tab-bar/./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue","webpack://fimoi-tab-bar/src/package/fimoiTabBar/index.vue","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue?6927","webpack://fimoi-tab-bar/./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js","webpack://fimoi-tab-bar/./src/package/fimoiTabBar/index.vue?9949","webpack://fimoi-tab-bar/./src/package/index.js","webpack://fimoi-tab-bar/./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"fimoi-tab-bar\"] = factory();\n\telse\n\t\troot[\"fimoi-tab-bar\"] = factory();\n})((typeof self !== 'undefined' ? self : this), function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"\";","/* eslint-disable no-var */\n// This file is imported into lib/wc client bundles.\n\nif (typeof window !== 'undefined') {\n var currentScript = window.document.currentScript\n if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {\n var getCurrentScript = require('@soda/get-current-script')\n currentScript = getCurrentScript()\n\n // for backward compatibility, because previously we directly included the polyfill\n if (!('currentScript' in document)) {\n Object.defineProperty(document, 'currentScript', { get: getCurrentScript })\n }\n }\n\n var src = currentScript && currentScript.src.match(/(.+\\/)[^/]+\\.js(\\?.*)?$/)\n if (src) {\n __webpack_public_path__ = src[1] // eslint-disable-line\n }\n}\n\n// Indicate to webpack that this file can be concatenated\nexport default null\n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"tabbar\",style:(_vm.barStyle)},_vm._l((_vm.tabs),function(item,index){return _c('button',{key:item.key || item.link || index,staticClass:\"tabbar-item\",class:{ active: _vm.currentIndex === index },style:(_vm.itemStyle),on:{\"click\":function($event){return _vm.handleSelect(index)}}},[(item.checked || item.unchecked)?[(_vm.currentIndex === index && item.checked)?_c('img',{staticClass:\"icon-image\",attrs:{\"src\":item.checked}}):(item.unchecked)?_c('img',{staticClass:\"icon-image\",attrs:{\"src\":item.unchecked}}):_vm._e()]:[_c('span',{staticClass:\"icon-text\",style:(_vm.iconTextStyle)},[_vm._v(_vm._s(item.icon))])],_c('span',{staticClass:\"label\",style:(_vm.labelStyle(_vm.currentIndex === index))},[_vm._v(_vm._s(item.name))])],2)}),0)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\r\n <div class=\"tabbar\" :style=\"barStyle\">\r\n <button v-for=\"(item, index) in tabs\" :key=\"item.key || item.link || index\" class=\"tabbar-item\"\r\n :class=\"{ active: currentIndex === index }\" :style=\"itemStyle\" @click=\"handleSelect(index)\">\r\n <template v-if=\"item.checked || item.unchecked\">\r\n <img v-if=\"currentIndex === index && item.checked\" class=\"icon-image\" :src=\"item.checked\" />\r\n <img v-else-if=\"item.unchecked\" class=\"icon-image\" :src=\"item.unchecked\" />\r\n </template>\r\n <template v-else>\r\n <span class=\"icon-text\" :style=\"iconTextStyle\">{{ item.icon }}</span>\r\n </template>\r\n <span class=\"label\" :style=\"labelStyle(currentIndex === index)\">{{ item.name }}</span>\r\n </button>\r\n </div>\r\n</template>\r\n<script>\r\n/* global uni */\r\nexport default {\r\n name: \"fimoi-tab-bar\",\r\n props: {\r\n tabs: {\r\n type: Array,\r\n default: () => [],\r\n },\r\n activeKey: {\r\n type: [String, Number],\r\n default: \"\",\r\n },\r\n activeIndex: {\r\n type: Number,\r\n default: 0,\r\n },\r\n styleConfig: {\r\n type: Object,\r\n default: () => ({}),\r\n },\r\n },\r\n data() {\r\n return {\r\n internalIndex: 0,\r\n };\r\n },\r\n computed: {\r\n currentIndex() {\r\n if (this.activeKey !== \"\") {\r\n const idx = this.tabs.findIndex(\r\n (item) => item.key === this.activeKey || item.link === this.activeKey,\r\n );\r\n return idx >= 0 ? idx : this.activeIndex;\r\n }\r\n return this.activeIndex !== undefined ? this.activeIndex : this.internalIndex;\r\n },\r\n barStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n position: config.position || \"fixed\",\r\n left: 0,\r\n right: 0,\r\n bottom: 0,\r\n height: toRpx(config.height) || \"128rpx\",\r\n background: config.background || \"#ffffff\",\r\n borderTop: toRpx(config.borderTop) || \"1rpx solid #eaeaea\",\r\n boxShadow: config.boxShadow || \"0 -12rpx 32rpx rgba(0, 0, 0, 0.06)\",\r\n paddingBottom: \"env(safe-area-inset-bottom)\", // 增加刘海屏适配\r\n };\r\n },\r\n itemStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n color: config.inactiveColor || \"#7a7a7a\",\r\n fontSize: toRpx(config.fontSize) || \"24rpx\",\r\n };\r\n },\r\n iconTextStyle() {\r\n const config = this.styleConfig || {};\r\n const toRpx = (val) => (typeof val === \"number\" ? `${val}rpx` : val);\r\n\r\n return {\r\n fontSize: toRpx(config.iconSize) || \"40rpx\",\r\n };\r\n },\r\n },\r\n methods: {\r\n handleSelect(index) {\r\n this.internalIndex = index;\r\n const item = this.tabs[index];\r\n if (item.link) {\r\n // 判断是否是 tabbar 页面,如果是则使用 switchTab,否则用 navigateTo\r\n // 这里提供一个 prop 或通过逻辑判断\r\n const isTab = item.isTab || false;\r\n if (isTab) {\r\n uni.switchTab({\r\n url: item.link,\r\n fail: (err) => {\r\n console.error(\"switchTab failed:\", err);\r\n // 如果 switchTab 失败,尝试 navigateTo\r\n uni.navigateTo({ url: item.link });\r\n }\r\n });\r\n } else {\r\n uni.navigateTo({\r\n url: item.link,\r\n fail: (err) => {\r\n console.error(\"navigateTo failed:\", err);\r\n // 如果 navigateTo 失败,尝试 switchTab\r\n uni.switchTab({ url: item.link });\r\n }\r\n });\r\n }\r\n }\r\n this.$emit(\"change\", item);\r\n },\r\n labelStyle(isActive) {\r\n return {\r\n color: isActive ? this.styleConfig.activeColor || \"#409eff\" : this.styleConfig.inactiveColor || \"#7a7a7a\",\r\n fontWeight: isActive ? this.styleConfig.activeWeight || 600 : this.styleConfig.inactiveWeight || 400,\r\n };\r\n },\r\n },\r\n};\r\n</script>\r\n<style scoped>\r\n.tabbar {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-around;\r\n}\r\n\r\n.tabbar-item {\r\n flex: 1;\r\n height: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n gap: 8rpx;\r\n border: none;\r\n background: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.icon-text {\r\n line-height: 1;\r\n}\r\n\r\n.icon-image {\r\n width: 40rpx;\r\n height: 40rpx;\r\n object-fit: contain;\r\n}\r\n</style>\r\n","import mod from \"-!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use[1]!../../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./index.vue?vue&type=script&lang=js\"","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent(\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier /* server only */,\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options =\n typeof scriptExports === 'function' ? scriptExports.options : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) {\n // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection(h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing ? [].concat(existing, hook) : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","import { render, staticRenderFns } from \"./index.vue?vue&type=template&id=6f870008&scoped=true\"\nimport script from \"./index.vue?vue&type=script&lang=js\"\nexport * from \"./index.vue?vue&type=script&lang=js\"\nimport style0 from \"./index.vue?vue&type=style&index=0&id=6f870008&prod&scoped=true&lang=css\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"6f870008\",\n null\n \n)\n\nexport default component.exports","\r\nimport FimoiTabBar from \"../package/fimoiTabBar/index.vue\"; // 引入封装好的组件\r\nconst coms = [ FimoiTabBar]; // 将来如果有其它组件,都可以写到这个数组里\r\n\r\n// 批量组件注册\r\nconst install = function (Vue) {\r\n coms.forEach((com) => {\r\n Vue.component(com.name, com);\r\n });\r\n};\r\n\r\nexport default install;","import './setPublicPath'\nimport mod from '~entry'\nexport default mod\nexport * from '~entry'\n"],"names":["root","factory","exports","module","define","amd","self","this","__webpack_require__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","p","window","currentScript","document","src","match","render","_vm","_c","_self","staticClass","style","barStyle","_l","tabs","item","index","link","class","active","currentIndex","itemStyle","on","$event","handleSelect","checked","unchecked","attrs","_e","iconTextStyle","_v","_s","icon","labelStyle","name","staticRenderFns","props","type","Array","default","activeKey","String","Number","activeIndex","styleConfig","data","internalIndex","computed","idx","findIndex","undefined","config","toRpx","val","position","left","right","bottom","height","background","borderTop","boxShadow","paddingBottom","color","inactiveColor","fontSize","iconSize","methods","isTab","uni","switchTab","url","fail","err","console","error","navigateTo","$emit","isActive","activeColor","fontWeight","activeWeight","inactiveWeight","normalizeComponent","scriptExports","functionalTemplate","injectStyles","scopeId","moduleIdentifier","shadowMode","hook","options","_compiled","functional","_scopeId","context","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","_injectStyles","originalRender","h","existing","beforeCreate","concat","component","coms","FimoiTabBar","install","Vue","forEach","com"],"sourceRoot":""}
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "fimoi-tab-bar",
3
+ "version": "1.0.0",
4
+ "main": "fimoi-tab-bar.common.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "keywords": [],
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": ""
12
+ }