fimoi-tab-bar 1.1.1 → 1.1.3

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.
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div>
3
+ <button>
4
+ 按钮1
5
+ </button>
6
+ </div>
7
+
8
+
9
+ </template>
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
  <div class="tabbar" :style="barStyle">
3
- <button v-for="(item, index) in processedTabs" :key="item.key || item.link || index" class="tabbar-item"
4
- :class="{ active: currentIndex === index }" :style="itemStyle" @click="handleSelect(index)">
3
+ <div v-for="(item, index) in processedTabs" :key="index" class="tabbar-item"
4
+ :class="{ active: currentIndex === index }" @click="handleSelect(index)">
5
5
  <template v-if="item.checked || item.unchecked">
6
6
  <img v-if="currentIndex === index && item.checked" class="icon-image" :src="item.checked" />
7
7
  <img v-else-if="item.unchecked" class="icon-image" :src="item.unchecked" />
8
8
  </template>
9
9
  <template v-else>
10
- <span class="icon-text" :style="iconTextStyle">{{ item.icon }}</span>
10
+ <span class="icon-text" :style="item.iconStyle">{{ item.icon }}</span>
11
11
  </template>
12
12
  <span class="label" :style="item.labelStyle">{{ item.name }}</span>
13
- </button>
13
+ </div>
14
14
  </div>
15
15
  </template>
16
16
  <script>
@@ -39,6 +39,9 @@ export default {
39
39
  return {
40
40
  internalIndex: 0,
41
41
  };
42
+ },
43
+ mounted() {
44
+
42
45
  },
43
46
  computed: {
44
47
  currentIndex() {
@@ -54,24 +57,25 @@ export default {
54
57
  const config = this.styleConfig || {};
55
58
  const toRpx = (val) => (typeof val === "number" ? `${val}rpx` : val);
56
59
 
57
- return {
60
+ const styles = {
58
61
  position: config.position || "fixed",
59
62
  left: 0,
60
63
  right: 0,
61
64
  bottom: 0,
62
65
  height: toRpx(config.height) || "128rpx",
63
- background: config.background || "#ffffff",
64
- borderTop: toRpx(config.borderTop) || "1rpx solid #eaeaea",
65
- boxShadow: config.boxShadow || "0 -12rpx 32rpx rgba(0, 0, 0, 0.06)",
66
+ background: config.background || "transparent", // 匹配图片中的深色背景
66
67
  paddingBottom: "env(safe-area-inset-bottom)", // 增加刘海屏适配
67
68
  };
69
+
70
+ return Object.keys(styles)
71
+ .map((key) => `${key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}: ${styles[key]}`)
72
+ .join("; ");
68
73
  },
69
74
  itemStyle() {
70
75
  const config = this.styleConfig || {};
71
76
  const toRpx = (val) => (typeof val === "number" ? `${val}rpx` : val);
72
77
 
73
78
  return {
74
- color: config.inactiveColor || "#7a7a7a",
75
79
  fontSize: toRpx(config.fontSize) || "24rpx",
76
80
  };
77
81
  },
@@ -84,18 +88,35 @@ export default {
84
88
  };
85
89
  },
86
90
  processedTabs() {
91
+ const config = this.styleConfig || {};
92
+ const toRpx = (val) => (typeof val === "number" ? `${val}rpx` : val);
93
+
87
94
  return this.tabs.map((item, index) => {
88
95
  const isActive = this.currentIndex === index;
96
+ const activeColor = config.activeColor || "#9d2dff"; // 用户要求的选中颜色
97
+ const inactiveColor = config.inactiveColor || "#ffffff80"; // 用户要求的未选中颜色
98
+ const fontSize = toRpx(config.fontSize) || "24rpx";
99
+ const iconSize = toRpx(config.iconSize) || "40rpx";
100
+
101
+ const iconStyles = {
102
+ color: isActive ? activeColor : inactiveColor,
103
+ fontSize: iconSize,
104
+ };
105
+
106
+ const labelStyles = {
107
+ color: isActive ? activeColor : inactiveColor,
108
+ fontSize: fontSize,
109
+ fontWeight: isActive ? config.activeWeight || "normal" : config.inactiveWeight || "normal",
110
+ };
111
+
89
112
  return {
90
113
  ...item,
91
- labelStyle: {
92
- color: isActive
93
- ? this.styleConfig.activeColor || "#409eff"
94
- : this.styleConfig.inactiveColor || "#7a7a7a",
95
- fontWeight: isActive
96
- ? this.styleConfig.activeWeight || 600
97
- : this.styleConfig.inactiveWeight || 400,
98
- },
114
+ iconStyle: Object.keys(iconStyles)
115
+ .map((key) => `${key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}: ${iconStyles[key]}`)
116
+ .join("; "),
117
+ labelStyle: Object.keys(labelStyles)
118
+ .map((key) => `${key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}: ${labelStyles[key]}`)
119
+ .join("; "),
99
120
  };
100
121
  });
101
122
  },
@@ -149,8 +170,14 @@ export default {
149
170
  justify-content: center;
150
171
  gap: 8rpx;
151
172
  border: none;
152
- background: transparent;
173
+ background: transparent !important;
153
174
  cursor: pointer;
175
+ -webkit-tap-highlight-color: transparent;
176
+ /* 移除移动端点击高亮 */
177
+ }
178
+
179
+ .tabbar-item.active {
180
+ background: transparent !important;
154
181
  }
155
182
 
156
183
  .icon-text {
package/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import FimoiTabBar from "./fimoiTabBar/index.vue";
2
+ import FimoiButton from "./fimoiButton/index.vue";
2
3
 
3
4
  // 批量组件注册
4
- const components = [FimoiTabBar];
5
+ const components = [FimoiTabBar, FimoiButton];
5
6
 
6
7
  const install = function (Vue) {
7
8
  components.forEach((component) => {
@@ -15,7 +16,8 @@ if (typeof window !== 'undefined' && window.Vue) {
15
16
  }
16
17
 
17
18
  export {
18
- FimoiTabBar
19
+ FimoiTabBar,
20
+ FimoiButton
19
21
  };
20
22
 
21
23
  export default {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimoi-tab-bar",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "一个基于 UniApp 的可配置底部标签栏组件,支持微信小程序。",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -14,6 +14,7 @@
14
14
  "license": "MIT",
15
15
  "files": [
16
16
  "index.js",
17
- "fimoiTabBar/index.vue"
17
+ "fimoiTabBar/index.vue",
18
+ "fimoiButton/index.vue"
18
19
  ]
19
20
  }