@hlw-uni/mp-vue 1.0.2 → 1.0.4
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/dist/components/hlw-menu-list/{index.d.ts → types.d.ts} +0 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +110 -113
- package/dist/index.mjs +111 -114
- package/dist/style.css +124 -0
- package/package.json +41 -39
- package/src/components/hlw-avatar/index.ts +1 -1
- package/src/components/hlw-avatar/index.vue +64 -3
- package/src/components/hlw-empty/index.ts +1 -1
- package/src/components/hlw-empty/index.vue +40 -3
- package/src/components/hlw-loading/index.ts +1 -1
- package/src/components/hlw-loading/index.vue +40 -3
- package/src/components/hlw-menu-list/index.vue +93 -3
- package/src/components/hlw-menu-list/types.ts +8 -0
- package/src/index.ts +5 -4
- package/src/components/hlw-menu-list/index.ts +0 -64
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* @hlw-uni/mp-vue — Vue 组件库统一导出
|
|
3
3
|
*/
|
|
4
4
|
export { default as HlwAd } from './components/hlw-ad/index.vue';
|
|
5
|
-
export { default as HlwAvatar } from './components/hlw-avatar/index';
|
|
6
|
-
export { default as HlwEmpty } from './components/hlw-empty/index';
|
|
7
|
-
export { default as HlwLoading } from './components/hlw-loading/index';
|
|
8
|
-
export { default as HlwMenuList
|
|
5
|
+
export { default as HlwAvatar } from './components/hlw-avatar/index.vue';
|
|
6
|
+
export { default as HlwEmpty } from './components/hlw-empty/index.vue';
|
|
7
|
+
export { default as HlwLoading } from './components/hlw-loading/index.vue';
|
|
8
|
+
export { default as HlwMenuList } from './components/hlw-menu-list/index.vue';
|
|
9
|
+
export type { MenuItem } from './components/hlw-menu-list/types';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.HlwUniVue = {}, global.vue));
|
|
3
3
|
})(this, function(exports2, vue) {
|
|
4
4
|
"use strict";
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
5
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
6
6
|
...{ name: "HlwAd" },
|
|
7
7
|
__name: "index",
|
|
8
8
|
props: {
|
|
@@ -33,114 +33,122 @@
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const _hoisted_1$3 = ["src"];
|
|
37
|
+
const _hoisted_2$3 = {
|
|
38
|
+
key: 1,
|
|
39
|
+
class: "hlw-avatar__placeholder"
|
|
40
|
+
};
|
|
41
|
+
const _hoisted_3$2 = { class: "hlw-avatar__initial" };
|
|
42
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
43
|
+
__name: "index",
|
|
38
44
|
props: {
|
|
39
|
-
src: {
|
|
40
|
-
name: {
|
|
41
|
-
size: {
|
|
45
|
+
src: {},
|
|
46
|
+
name: {},
|
|
47
|
+
size: {}
|
|
42
48
|
},
|
|
43
|
-
setup(
|
|
49
|
+
setup(__props) {
|
|
50
|
+
const props = __props;
|
|
44
51
|
const loadError = vue.ref(false);
|
|
45
52
|
const initial = vue.computed(() => {
|
|
46
53
|
if (!props.name)
|
|
47
54
|
return "?";
|
|
48
55
|
return props.name.charAt(0).toUpperCase();
|
|
49
56
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onError
|
|
65
|
-
})
|
|
66
|
-
) : (
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
h("view", { class: "hlw-avatar__placeholder" }, [
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
h("text", { class: "hlw-avatar__initial" }, initial.value)
|
|
71
|
-
])
|
|
72
|
-
)
|
|
73
|
-
])
|
|
74
|
-
);
|
|
57
|
+
return (_ctx, _cache) => {
|
|
58
|
+
return vue.openBlock(), vue.createElementBlock("view", {
|
|
59
|
+
class: vue.normalizeClass(`hlw-avatar hlw-avatar--${__props.size ?? "medium"}`)
|
|
60
|
+
}, [
|
|
61
|
+
__props.src && !loadError.value ? (vue.openBlock(), vue.createElementBlock("image", {
|
|
62
|
+
key: 0,
|
|
63
|
+
class: "hlw-avatar__image",
|
|
64
|
+
src: __props.src,
|
|
65
|
+
mode: "aspectFill",
|
|
66
|
+
onError: _cache[0] || (_cache[0] = ($event) => loadError.value = true)
|
|
67
|
+
}, null, 40, _hoisted_1$3)) : (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$3, [
|
|
68
|
+
vue.createElementVNode("text", _hoisted_3$2, vue.toDisplayString(initial.value), 1)
|
|
69
|
+
]))
|
|
70
|
+
], 2);
|
|
75
71
|
};
|
|
76
72
|
}
|
|
77
73
|
});
|
|
78
|
-
const
|
|
79
|
-
|
|
74
|
+
const _export_sfc = (sfc, props) => {
|
|
75
|
+
const target = sfc.__vccOpts || sfc;
|
|
76
|
+
for (const [key, val] of props) {
|
|
77
|
+
target[key] = val;
|
|
78
|
+
}
|
|
79
|
+
return target;
|
|
80
|
+
};
|
|
81
|
+
const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7e8f98a5"]]);
|
|
82
|
+
const _hoisted_1$2 = { class: "hlw-empty" };
|
|
83
|
+
const _hoisted_2$2 = ["src"];
|
|
84
|
+
const _hoisted_3$1 = {
|
|
85
|
+
key: 1,
|
|
86
|
+
class: "hlw-empty__icon"
|
|
87
|
+
};
|
|
88
|
+
const _hoisted_4$1 = { class: "hlw-empty__text" };
|
|
89
|
+
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
90
|
+
__name: "index",
|
|
80
91
|
props: {
|
|
81
|
-
text: {
|
|
82
|
-
image: {
|
|
92
|
+
text: {},
|
|
93
|
+
image: {}
|
|
83
94
|
},
|
|
84
|
-
setup(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
h("view", { class: "hlw-empty__icon" }, [
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
h("text", "📦")
|
|
99
|
-
])
|
|
100
|
-
),
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
h("text", { class: "hlw-empty__text" }, props.text || "暂无数据"),
|
|
103
|
-
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
|
104
|
-
])
|
|
105
|
-
);
|
|
95
|
+
setup(__props) {
|
|
96
|
+
return (_ctx, _cache) => {
|
|
97
|
+
return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$2, [
|
|
98
|
+
__props.image ? (vue.openBlock(), vue.createElementBlock("image", {
|
|
99
|
+
key: 0,
|
|
100
|
+
class: "hlw-empty__image",
|
|
101
|
+
src: __props.image,
|
|
102
|
+
mode: "aspectFit"
|
|
103
|
+
}, null, 8, _hoisted_2$2)) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_3$1, "📦")),
|
|
104
|
+
vue.createElementVNode("text", _hoisted_4$1, vue.toDisplayString(__props.text || "暂无数据"), 1),
|
|
105
|
+
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
106
|
+
]);
|
|
106
107
|
};
|
|
107
108
|
}
|
|
108
109
|
});
|
|
109
|
-
const index$
|
|
110
|
-
|
|
110
|
+
const index$2 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-72364322"]]);
|
|
111
|
+
const _hoisted_1$1 = { class: "hlw-loading" };
|
|
112
|
+
const _hoisted_2$1 = {
|
|
113
|
+
key: 0,
|
|
114
|
+
class: "hlw-loading__text"
|
|
115
|
+
};
|
|
116
|
+
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
117
|
+
__name: "index",
|
|
111
118
|
props: {
|
|
112
|
-
text: {
|
|
119
|
+
text: {}
|
|
113
120
|
},
|
|
114
|
-
setup(
|
|
115
|
-
return () => {
|
|
116
|
-
|
|
117
|
-
{
|
|
118
|
-
(
|
|
119
|
-
|
|
120
|
-
h("view", { key: i + 1, class: "hlw-loading__dot" })
|
|
121
|
-
)
|
|
122
|
-
);
|
|
123
|
-
return (
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
h("view", { class: "hlw-loading" }, [
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
h("view", { class: "hlw-loading__spinner" }, dots),
|
|
128
|
-
props.text ? (
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
h("text", { class: "hlw-loading__text" }, props.text)
|
|
131
|
-
) : null
|
|
132
|
-
])
|
|
133
|
-
);
|
|
121
|
+
setup(__props) {
|
|
122
|
+
return (_ctx, _cache) => {
|
|
123
|
+
return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$1, [
|
|
124
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("view", { class: "hlw-loading__spinner" }, null, -1)),
|
|
125
|
+
__props.text ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_2$1, vue.toDisplayString(__props.text), 1)) : vue.createCommentVNode("", true)
|
|
126
|
+
]);
|
|
134
127
|
};
|
|
135
128
|
}
|
|
136
129
|
});
|
|
137
|
-
const index =
|
|
138
|
-
|
|
130
|
+
const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-14242381"]]);
|
|
131
|
+
const _hoisted_1 = { class: "hlw-menu-list" };
|
|
132
|
+
const _hoisted_2 = ["onTap"];
|
|
133
|
+
const _hoisted_3 = { class: "hlw-menu-list__left" };
|
|
134
|
+
const _hoisted_4 = {
|
|
135
|
+
key: 0,
|
|
136
|
+
class: "hlw-menu-list__icon"
|
|
137
|
+
};
|
|
138
|
+
const _hoisted_5 = { class: "hlw-menu-list__label" };
|
|
139
|
+
const _hoisted_6 = { class: "hlw-menu-list__right" };
|
|
140
|
+
const _hoisted_7 = {
|
|
141
|
+
key: 0,
|
|
142
|
+
class: "hlw-menu-list__value"
|
|
143
|
+
};
|
|
144
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
145
|
+
__name: "index",
|
|
139
146
|
props: {
|
|
140
|
-
items: {
|
|
147
|
+
items: {}
|
|
141
148
|
},
|
|
142
149
|
emits: ["click"],
|
|
143
|
-
setup(
|
|
150
|
+
setup(__props, { emit: __emit }) {
|
|
151
|
+
const emit = __emit;
|
|
144
152
|
function onTap(item) {
|
|
145
153
|
if (item.url) {
|
|
146
154
|
uni.navigateTo({ url: item.url });
|
|
@@ -149,41 +157,30 @@
|
|
|
149
157
|
}
|
|
150
158
|
emit("click", item);
|
|
151
159
|
}
|
|
152
|
-
return () => {
|
|
153
|
-
|
|
154
|
-
(item) =>
|
|
155
|
-
|
|
156
|
-
h("view", {
|
|
157
|
-
class: "hlw-menu-list__item",
|
|
160
|
+
return (_ctx, _cache) => {
|
|
161
|
+
return vue.openBlock(), vue.createElementBlock("view", _hoisted_1, [
|
|
162
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.items, (item) => {
|
|
163
|
+
return vue.openBlock(), vue.createElementBlock("view", {
|
|
158
164
|
key: item.key,
|
|
159
|
-
|
|
165
|
+
class: "hlw-menu-list__item",
|
|
166
|
+
onTap: ($event) => onTap(item)
|
|
160
167
|
}, [
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
// @ts-ignore
|
|
165
|
-
h("text", { class: "hlw-menu-list__icon" }, item.icon)
|
|
166
|
-
) : null,
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
h("text", { class: "hlw-menu-list__label" }, item.label)
|
|
168
|
+
vue.createElementVNode("view", _hoisted_3, [
|
|
169
|
+
item.icon ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_4, vue.toDisplayString(item.icon), 1)) : vue.createCommentVNode("", true),
|
|
170
|
+
vue.createElementVNode("text", _hoisted_5, vue.toDisplayString(item.label), 1)
|
|
169
171
|
]),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// @ts-ignore
|
|
174
|
-
h("text", { class: "hlw-menu-list__value" }, item.value)
|
|
175
|
-
) : null,
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
h("text", { class: "hlw-menu-list__arrow" }, "›")
|
|
172
|
+
vue.createElementVNode("view", _hoisted_6, [
|
|
173
|
+
item.value ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_7, vue.toDisplayString(item.value), 1)) : vue.createCommentVNode("", true),
|
|
174
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("text", { class: "hlw-menu-list__arrow" }, "›", -1))
|
|
178
175
|
])
|
|
179
|
-
])
|
|
180
|
-
)
|
|
181
|
-
);
|
|
182
|
-
return h("view", { class: "hlw-menu-list" }, items);
|
|
176
|
+
], 40, _hoisted_2);
|
|
177
|
+
}), 128))
|
|
178
|
+
]);
|
|
183
179
|
};
|
|
184
180
|
}
|
|
185
181
|
});
|
|
186
|
-
|
|
182
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e465b0b4"]]);
|
|
183
|
+
exports2.HlwAd = _sfc_main$4;
|
|
187
184
|
exports2.HlwAvatar = index$3;
|
|
188
185
|
exports2.HlwEmpty = index$2;
|
|
189
186
|
exports2.HlwLoading = index$1;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, resolveComponent, openBlock, createBlock, ref, computed,
|
|
2
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1
|
+
import { defineComponent, resolveComponent, openBlock, createBlock, ref, computed, createElementBlock, normalizeClass, createElementVNode, toDisplayString, renderSlot, createCommentVNode, Fragment, renderList } from "vue";
|
|
2
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
3
3
|
...{ name: "HlwAd" },
|
|
4
4
|
__name: "index",
|
|
5
5
|
props: {
|
|
@@ -30,114 +30,122 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const _hoisted_1$3 = ["src"];
|
|
34
|
+
const _hoisted_2$3 = {
|
|
35
|
+
key: 1,
|
|
36
|
+
class: "hlw-avatar__placeholder"
|
|
37
|
+
};
|
|
38
|
+
const _hoisted_3$2 = { class: "hlw-avatar__initial" };
|
|
39
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
40
|
+
__name: "index",
|
|
35
41
|
props: {
|
|
36
|
-
src: {
|
|
37
|
-
name: {
|
|
38
|
-
size: {
|
|
42
|
+
src: {},
|
|
43
|
+
name: {},
|
|
44
|
+
size: {}
|
|
39
45
|
},
|
|
40
|
-
setup(
|
|
46
|
+
setup(__props) {
|
|
47
|
+
const props = __props;
|
|
41
48
|
const loadError = ref(false);
|
|
42
49
|
const initial = computed(() => {
|
|
43
50
|
if (!props.name)
|
|
44
51
|
return "?";
|
|
45
52
|
return props.name.charAt(0).toUpperCase();
|
|
46
53
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
onError
|
|
62
|
-
})
|
|
63
|
-
) : (
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
h("view", { class: "hlw-avatar__placeholder" }, [
|
|
66
|
-
// @ts-ignore
|
|
67
|
-
h("text", { class: "hlw-avatar__initial" }, initial.value)
|
|
68
|
-
])
|
|
69
|
-
)
|
|
70
|
-
])
|
|
71
|
-
);
|
|
54
|
+
return (_ctx, _cache) => {
|
|
55
|
+
return openBlock(), createElementBlock("view", {
|
|
56
|
+
class: normalizeClass(`hlw-avatar hlw-avatar--${__props.size ?? "medium"}`)
|
|
57
|
+
}, [
|
|
58
|
+
__props.src && !loadError.value ? (openBlock(), createElementBlock("image", {
|
|
59
|
+
key: 0,
|
|
60
|
+
class: "hlw-avatar__image",
|
|
61
|
+
src: __props.src,
|
|
62
|
+
mode: "aspectFill",
|
|
63
|
+
onError: _cache[0] || (_cache[0] = ($event) => loadError.value = true)
|
|
64
|
+
}, null, 40, _hoisted_1$3)) : (openBlock(), createElementBlock("view", _hoisted_2$3, [
|
|
65
|
+
createElementVNode("text", _hoisted_3$2, toDisplayString(initial.value), 1)
|
|
66
|
+
]))
|
|
67
|
+
], 2);
|
|
72
68
|
};
|
|
73
69
|
}
|
|
74
70
|
});
|
|
75
|
-
const
|
|
76
|
-
|
|
71
|
+
const _export_sfc = (sfc, props) => {
|
|
72
|
+
const target = sfc.__vccOpts || sfc;
|
|
73
|
+
for (const [key, val] of props) {
|
|
74
|
+
target[key] = val;
|
|
75
|
+
}
|
|
76
|
+
return target;
|
|
77
|
+
};
|
|
78
|
+
const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7e8f98a5"]]);
|
|
79
|
+
const _hoisted_1$2 = { class: "hlw-empty" };
|
|
80
|
+
const _hoisted_2$2 = ["src"];
|
|
81
|
+
const _hoisted_3$1 = {
|
|
82
|
+
key: 1,
|
|
83
|
+
class: "hlw-empty__icon"
|
|
84
|
+
};
|
|
85
|
+
const _hoisted_4$1 = { class: "hlw-empty__text" };
|
|
86
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
87
|
+
__name: "index",
|
|
77
88
|
props: {
|
|
78
|
-
text: {
|
|
79
|
-
image: {
|
|
89
|
+
text: {},
|
|
90
|
+
image: {}
|
|
80
91
|
},
|
|
81
|
-
setup(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
h("view", { class: "hlw-empty__icon" }, [
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
h("text", "📦")
|
|
96
|
-
])
|
|
97
|
-
),
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
h("text", { class: "hlw-empty__text" }, props.text || "暂无数据"),
|
|
100
|
-
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
|
101
|
-
])
|
|
102
|
-
);
|
|
92
|
+
setup(__props) {
|
|
93
|
+
return (_ctx, _cache) => {
|
|
94
|
+
return openBlock(), createElementBlock("view", _hoisted_1$2, [
|
|
95
|
+
__props.image ? (openBlock(), createElementBlock("image", {
|
|
96
|
+
key: 0,
|
|
97
|
+
class: "hlw-empty__image",
|
|
98
|
+
src: __props.image,
|
|
99
|
+
mode: "aspectFit"
|
|
100
|
+
}, null, 8, _hoisted_2$2)) : (openBlock(), createElementBlock("text", _hoisted_3$1, "📦")),
|
|
101
|
+
createElementVNode("text", _hoisted_4$1, toDisplayString(__props.text || "暂无数据"), 1),
|
|
102
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
103
|
+
]);
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
});
|
|
106
|
-
const index$
|
|
107
|
-
|
|
107
|
+
const index$2 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-72364322"]]);
|
|
108
|
+
const _hoisted_1$1 = { class: "hlw-loading" };
|
|
109
|
+
const _hoisted_2$1 = {
|
|
110
|
+
key: 0,
|
|
111
|
+
class: "hlw-loading__text"
|
|
112
|
+
};
|
|
113
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
114
|
+
__name: "index",
|
|
108
115
|
props: {
|
|
109
|
-
text: {
|
|
116
|
+
text: {}
|
|
110
117
|
},
|
|
111
|
-
setup(
|
|
112
|
-
return () => {
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
(
|
|
116
|
-
|
|
117
|
-
h("view", { key: i + 1, class: "hlw-loading__dot" })
|
|
118
|
-
)
|
|
119
|
-
);
|
|
120
|
-
return (
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
h("view", { class: "hlw-loading" }, [
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
h("view", { class: "hlw-loading__spinner" }, dots),
|
|
125
|
-
props.text ? (
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
h("text", { class: "hlw-loading__text" }, props.text)
|
|
128
|
-
) : null
|
|
129
|
-
])
|
|
130
|
-
);
|
|
118
|
+
setup(__props) {
|
|
119
|
+
return (_ctx, _cache) => {
|
|
120
|
+
return openBlock(), createElementBlock("view", _hoisted_1$1, [
|
|
121
|
+
_cache[0] || (_cache[0] = createElementVNode("view", { class: "hlw-loading__spinner" }, null, -1)),
|
|
122
|
+
__props.text ? (openBlock(), createElementBlock("text", _hoisted_2$1, toDisplayString(__props.text), 1)) : createCommentVNode("", true)
|
|
123
|
+
]);
|
|
131
124
|
};
|
|
132
125
|
}
|
|
133
126
|
});
|
|
134
|
-
const index =
|
|
135
|
-
|
|
127
|
+
const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-14242381"]]);
|
|
128
|
+
const _hoisted_1 = { class: "hlw-menu-list" };
|
|
129
|
+
const _hoisted_2 = ["onTap"];
|
|
130
|
+
const _hoisted_3 = { class: "hlw-menu-list__left" };
|
|
131
|
+
const _hoisted_4 = {
|
|
132
|
+
key: 0,
|
|
133
|
+
class: "hlw-menu-list__icon"
|
|
134
|
+
};
|
|
135
|
+
const _hoisted_5 = { class: "hlw-menu-list__label" };
|
|
136
|
+
const _hoisted_6 = { class: "hlw-menu-list__right" };
|
|
137
|
+
const _hoisted_7 = {
|
|
138
|
+
key: 0,
|
|
139
|
+
class: "hlw-menu-list__value"
|
|
140
|
+
};
|
|
141
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
142
|
+
__name: "index",
|
|
136
143
|
props: {
|
|
137
|
-
items: {
|
|
144
|
+
items: {}
|
|
138
145
|
},
|
|
139
146
|
emits: ["click"],
|
|
140
|
-
setup(
|
|
147
|
+
setup(__props, { emit: __emit }) {
|
|
148
|
+
const emit = __emit;
|
|
141
149
|
function onTap(item) {
|
|
142
150
|
if (item.url) {
|
|
143
151
|
uni.navigateTo({ url: item.url });
|
|
@@ -146,42 +154,31 @@ const index = defineComponent({
|
|
|
146
154
|
}
|
|
147
155
|
emit("click", item);
|
|
148
156
|
}
|
|
149
|
-
return () => {
|
|
150
|
-
|
|
151
|
-
(item) =>
|
|
152
|
-
|
|
153
|
-
h("view", {
|
|
154
|
-
class: "hlw-menu-list__item",
|
|
157
|
+
return (_ctx, _cache) => {
|
|
158
|
+
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
159
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
160
|
+
return openBlock(), createElementBlock("view", {
|
|
155
161
|
key: item.key,
|
|
156
|
-
|
|
162
|
+
class: "hlw-menu-list__item",
|
|
163
|
+
onTap: ($event) => onTap(item)
|
|
157
164
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
item.
|
|
161
|
-
// @ts-ignore
|
|
162
|
-
h("text", { class: "hlw-menu-list__icon" }, item.icon)
|
|
163
|
-
) : null,
|
|
164
|
-
// @ts-ignore
|
|
165
|
-
h("text", { class: "hlw-menu-list__label" }, item.label)
|
|
165
|
+
createElementVNode("view", _hoisted_3, [
|
|
166
|
+
item.icon ? (openBlock(), createElementBlock("text", _hoisted_4, toDisplayString(item.icon), 1)) : createCommentVNode("", true),
|
|
167
|
+
createElementVNode("text", _hoisted_5, toDisplayString(item.label), 1)
|
|
166
168
|
]),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// @ts-ignore
|
|
171
|
-
h("text", { class: "hlw-menu-list__value" }, item.value)
|
|
172
|
-
) : null,
|
|
173
|
-
// @ts-ignore
|
|
174
|
-
h("text", { class: "hlw-menu-list__arrow" }, "›")
|
|
169
|
+
createElementVNode("view", _hoisted_6, [
|
|
170
|
+
item.value ? (openBlock(), createElementBlock("text", _hoisted_7, toDisplayString(item.value), 1)) : createCommentVNode("", true),
|
|
171
|
+
_cache[0] || (_cache[0] = createElementVNode("text", { class: "hlw-menu-list__arrow" }, "›", -1))
|
|
175
172
|
])
|
|
176
|
-
])
|
|
177
|
-
)
|
|
178
|
-
);
|
|
179
|
-
return h("view", { class: "hlw-menu-list" }, items);
|
|
173
|
+
], 40, _hoisted_2);
|
|
174
|
+
}), 128))
|
|
175
|
+
]);
|
|
180
176
|
};
|
|
181
177
|
}
|
|
182
178
|
});
|
|
179
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e465b0b4"]]);
|
|
183
180
|
export {
|
|
184
|
-
_sfc_main as HlwAd,
|
|
181
|
+
_sfc_main$4 as HlwAd,
|
|
185
182
|
index$3 as HlwAvatar,
|
|
186
183
|
index$2 as HlwEmpty,
|
|
187
184
|
index$1 as HlwLoading,
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
|
|
2
|
+
.hlw-avatar[data-v-7e8f98a5] {
|
|
3
|
+
border-radius: 50%;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
}
|
|
7
|
+
.hlw-avatar--small[data-v-7e8f98a5] { width: 56rpx; height: 56rpx;
|
|
8
|
+
}
|
|
9
|
+
.hlw-avatar--medium[data-v-7e8f98a5] { width: 80rpx; height: 80rpx;
|
|
10
|
+
}
|
|
11
|
+
.hlw-avatar--large[data-v-7e8f98a5] { width: 120rpx; height: 120rpx;
|
|
12
|
+
}
|
|
13
|
+
.hlw-avatar__image[data-v-7e8f98a5] {
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
.hlw-avatar__placeholder[data-v-7e8f98a5] {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
background: #07c160;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
25
|
+
.hlw-avatar__initial[data-v-7e8f98a5] {
|
|
26
|
+
color: #fff;
|
|
27
|
+
font-weight: bold;
|
|
28
|
+
}
|
|
29
|
+
.hlw-avatar--small .hlw-avatar__initial[data-v-7e8f98a5] { font-size: 22rpx;
|
|
30
|
+
}
|
|
31
|
+
.hlw-avatar--medium .hlw-avatar__initial[data-v-7e8f98a5] { font-size: 30rpx;
|
|
32
|
+
}
|
|
33
|
+
.hlw-avatar--large .hlw-avatar__initial[data-v-7e8f98a5] { font-size: 46rpx;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.hlw-empty[data-v-72364322] {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
padding: 80rpx 40rpx;
|
|
42
|
+
}
|
|
43
|
+
.hlw-empty__image[data-v-72364322] {
|
|
44
|
+
width: 200rpx;
|
|
45
|
+
height: 200rpx;
|
|
46
|
+
margin-bottom: 24rpx;
|
|
47
|
+
}
|
|
48
|
+
.hlw-empty__icon[data-v-72364322] {
|
|
49
|
+
font-size: 100rpx;
|
|
50
|
+
margin-bottom: 20rpx;
|
|
51
|
+
}
|
|
52
|
+
.hlw-empty__text[data-v-72364322] {
|
|
53
|
+
font-size: 28rpx;
|
|
54
|
+
color: #bbb;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.hlw-loading[data-v-14242381] {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
padding: 24rpx;
|
|
63
|
+
}
|
|
64
|
+
.hlw-loading__spinner[data-v-14242381] {
|
|
65
|
+
width: 56rpx;
|
|
66
|
+
height: 56rpx;
|
|
67
|
+
border: 6rpx solid #e8e8e8;
|
|
68
|
+
border-top-color: #07c160;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
animation: hlw-spin-14242381 0.8s linear infinite;
|
|
71
|
+
}
|
|
72
|
+
@keyframes hlw-spin-14242381 {
|
|
73
|
+
to { transform: rotate(360deg);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.hlw-loading__text[data-v-14242381] {
|
|
77
|
+
margin-top: 16rpx;
|
|
78
|
+
font-size: 26rpx;
|
|
79
|
+
color: #999;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.hlw-menu-list[data-v-e465b0b4] {
|
|
83
|
+
background: #fff;
|
|
84
|
+
border-radius: 16rpx;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
}
|
|
87
|
+
.hlw-menu-list__item[data-v-e465b0b4] {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
padding: 28rpx 32rpx;
|
|
92
|
+
border-bottom: 1rpx solid #f5f5f5;
|
|
93
|
+
}
|
|
94
|
+
.hlw-menu-list__item[data-v-e465b0b4]:last-child {
|
|
95
|
+
border-bottom: none;
|
|
96
|
+
}
|
|
97
|
+
.hlw-menu-list__left[data-v-e465b0b4] {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: 16rpx;
|
|
101
|
+
}
|
|
102
|
+
.hlw-menu-list__icon[data-v-e465b0b4] {
|
|
103
|
+
font-size: 36rpx;
|
|
104
|
+
width: 44rpx;
|
|
105
|
+
text-align: center;
|
|
106
|
+
}
|
|
107
|
+
.hlw-menu-list__label[data-v-e465b0b4] {
|
|
108
|
+
font-size: 30rpx;
|
|
109
|
+
color: #333;
|
|
110
|
+
}
|
|
111
|
+
.hlw-menu-list__right[data-v-e465b0b4] {
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
gap: 8rpx;
|
|
115
|
+
}
|
|
116
|
+
.hlw-menu-list__value[data-v-e465b0b4] {
|
|
117
|
+
font-size: 28rpx;
|
|
118
|
+
color: #999;
|
|
119
|
+
}
|
|
120
|
+
.hlw-menu-list__arrow[data-v-e465b0b4] {
|
|
121
|
+
font-size: 36rpx;
|
|
122
|
+
color: #ccc;
|
|
123
|
+
line-height: 1;
|
|
124
|
+
}
|
package/package.json
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"name": "@hlw-uni/mp-vue",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "hlw-uni Vue 组件库 — 供小程序业务方使用的 UI 组件集合",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./src/*": "./src/*",
|
|
15
|
+
"./*.vue": "./*.vue"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"src"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "vite build",
|
|
23
|
+
"dev": "vite build --watch"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"vue": ">=3.4.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@dcloudio/types": "^3.4.8",
|
|
33
|
+
"@types/node": "^20.11.0",
|
|
34
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
35
|
+
"typescript": "^4.9.4",
|
|
36
|
+
"vite": "5.2.8",
|
|
37
|
+
"vite-plugin-dts": "^4.5.4",
|
|
38
|
+
"vue": "^3.4.0"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@hlw-uni/mp-core": "^1.0.10"
|
|
13
42
|
}
|
|
14
|
-
|
|
15
|
-
"files": [
|
|
16
|
-
"dist",
|
|
17
|
-
"src"
|
|
18
|
-
],
|
|
19
|
-
"publishConfig": {
|
|
20
|
-
"access": "public"
|
|
21
|
-
},
|
|
22
|
-
"peerDependencies": {
|
|
23
|
-
"vue": ">=3.4.0"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@dcloudio/types": "^3.4.8",
|
|
27
|
-
"@types/node": "^20.11.0",
|
|
28
|
-
"@vitejs/plugin-vue": "^5.0.0",
|
|
29
|
-
"typescript": "^4.9.4",
|
|
30
|
-
"vite": "5.2.8",
|
|
31
|
-
"vite-plugin-dts": "^4.5.4",
|
|
32
|
-
"vue": "^3.4.0"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@hlw-uni/mp-core": "^1.0.7"
|
|
36
|
-
},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "vite build",
|
|
39
|
-
"dev": "vite build --watch"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
43
|
+
}
|
|
@@ -1,4 +1,65 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`hlw-avatar hlw-avatar--${size ?? 'medium'}`">
|
|
3
|
+
<image
|
|
4
|
+
v-if="src && !loadError"
|
|
5
|
+
class="hlw-avatar__image"
|
|
6
|
+
:src="src"
|
|
7
|
+
mode="aspectFill"
|
|
8
|
+
@error="loadError = true"
|
|
9
|
+
/>
|
|
10
|
+
<view v-else class="hlw-avatar__placeholder">
|
|
11
|
+
<text class="hlw-avatar__initial">{{ initial }}</text>
|
|
12
|
+
</view>
|
|
13
|
+
</view>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { ref, computed } from 'vue';
|
|
18
|
+
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
src?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
size?: 'small' | 'medium' | 'large';
|
|
23
|
+
}>();
|
|
24
|
+
|
|
25
|
+
const loadError = ref(false);
|
|
26
|
+
const initial = computed(() => {
|
|
27
|
+
if (!props.name) return '?';
|
|
28
|
+
return props.name.charAt(0).toUpperCase();
|
|
29
|
+
});
|
|
4
30
|
</script>
|
|
31
|
+
|
|
32
|
+
<style scoped>
|
|
33
|
+
.hlw-avatar {
|
|
34
|
+
border-radius: 50%;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.hlw-avatar--small { width: 56rpx; height: 56rpx; }
|
|
40
|
+
.hlw-avatar--medium { width: 80rpx; height: 80rpx; }
|
|
41
|
+
.hlw-avatar--large { width: 120rpx; height: 120rpx; }
|
|
42
|
+
|
|
43
|
+
.hlw-avatar__image {
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.hlw-avatar__placeholder {
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
background: #07c160;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.hlw-avatar__initial {
|
|
58
|
+
color: #fff;
|
|
59
|
+
font-weight: bold;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.hlw-avatar--small .hlw-avatar__initial { font-size: 22rpx; }
|
|
63
|
+
.hlw-avatar--medium .hlw-avatar__initial { font-size: 30rpx; }
|
|
64
|
+
.hlw-avatar--large .hlw-avatar__initial { font-size: 46rpx; }
|
|
65
|
+
</style>
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hlw-empty">
|
|
3
|
+
<image v-if="image" class="hlw-empty__image" :src="image" mode="aspectFit" />
|
|
4
|
+
<text v-else class="hlw-empty__icon">📦</text>
|
|
5
|
+
<text class="hlw-empty__text">{{ text || '暂无数据' }}</text>
|
|
6
|
+
<slot />
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
defineProps<{
|
|
12
|
+
text?: string;
|
|
13
|
+
image?: string;
|
|
14
|
+
}>();
|
|
4
15
|
</script>
|
|
16
|
+
|
|
17
|
+
<style scoped>
|
|
18
|
+
.hlw-empty {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
padding: 80rpx 40rpx;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.hlw-empty__image {
|
|
27
|
+
width: 200rpx;
|
|
28
|
+
height: 200rpx;
|
|
29
|
+
margin-bottom: 24rpx;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.hlw-empty__icon {
|
|
33
|
+
font-size: 100rpx;
|
|
34
|
+
margin-bottom: 20rpx;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.hlw-empty__text {
|
|
38
|
+
font-size: 28rpx;
|
|
39
|
+
color: #bbb;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hlw-loading">
|
|
3
|
+
<view class="hlw-loading__spinner" />
|
|
4
|
+
<text v-if="text" class="hlw-loading__text">{{ text }}</text>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
defineProps<{
|
|
10
|
+
text?: string;
|
|
11
|
+
}>();
|
|
4
12
|
</script>
|
|
13
|
+
|
|
14
|
+
<style scoped>
|
|
15
|
+
.hlw-loading {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
padding: 24rpx;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.hlw-loading__spinner {
|
|
24
|
+
width: 56rpx;
|
|
25
|
+
height: 56rpx;
|
|
26
|
+
border: 6rpx solid #e8e8e8;
|
|
27
|
+
border-top-color: #07c160;
|
|
28
|
+
border-radius: 50%;
|
|
29
|
+
animation: hlw-spin 0.8s linear infinite;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@keyframes hlw-spin {
|
|
33
|
+
to { transform: rotate(360deg); }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.hlw-loading__text {
|
|
37
|
+
margin-top: 16rpx;
|
|
38
|
+
font-size: 26rpx;
|
|
39
|
+
color: #999;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -1,4 +1,94 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hlw-menu-list">
|
|
3
|
+
<view
|
|
4
|
+
v-for="item in items"
|
|
5
|
+
:key="item.key"
|
|
6
|
+
class="hlw-menu-list__item"
|
|
7
|
+
@tap="onTap(item)"
|
|
8
|
+
>
|
|
9
|
+
<view class="hlw-menu-list__left">
|
|
10
|
+
<text v-if="item.icon" class="hlw-menu-list__icon">{{ item.icon }}</text>
|
|
11
|
+
<text class="hlw-menu-list__label">{{ item.label }}</text>
|
|
12
|
+
</view>
|
|
13
|
+
<view class="hlw-menu-list__right">
|
|
14
|
+
<text v-if="item.value" class="hlw-menu-list__value">{{ item.value }}</text>
|
|
15
|
+
<text class="hlw-menu-list__arrow">›</text>
|
|
16
|
+
</view>
|
|
17
|
+
</view>
|
|
18
|
+
</view>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import type { MenuItem } from './types';
|
|
23
|
+
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
items: MenuItem[];
|
|
26
|
+
}>();
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits<{
|
|
29
|
+
(e: 'click', item: MenuItem): void;
|
|
30
|
+
}>();
|
|
31
|
+
|
|
32
|
+
function onTap(item: MenuItem) {
|
|
33
|
+
if (item.url) {
|
|
34
|
+
uni.navigateTo({ url: item.url });
|
|
35
|
+
} else if (item.action) {
|
|
36
|
+
item.action();
|
|
37
|
+
}
|
|
38
|
+
emit('click', item);
|
|
39
|
+
}
|
|
4
40
|
</script>
|
|
41
|
+
|
|
42
|
+
<style scoped>
|
|
43
|
+
.hlw-menu-list {
|
|
44
|
+
background: #fff;
|
|
45
|
+
border-radius: 16rpx;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.hlw-menu-list__item {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
padding: 28rpx 32rpx;
|
|
54
|
+
border-bottom: 1rpx solid #f5f5f5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.hlw-menu-list__item:last-child {
|
|
58
|
+
border-bottom: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hlw-menu-list__left {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 16rpx;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.hlw-menu-list__icon {
|
|
68
|
+
font-size: 36rpx;
|
|
69
|
+
width: 44rpx;
|
|
70
|
+
text-align: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.hlw-menu-list__label {
|
|
74
|
+
font-size: 30rpx;
|
|
75
|
+
color: #333;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.hlw-menu-list__right {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 8rpx;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.hlw-menu-list__value {
|
|
85
|
+
font-size: 28rpx;
|
|
86
|
+
color: #999;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.hlw-menu-list__arrow {
|
|
90
|
+
font-size: 36rpx;
|
|
91
|
+
color: #ccc;
|
|
92
|
+
line-height: 1;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export { default as HlwAd } from './components/hlw-ad/index.vue';
|
|
6
|
-
export { default as HlwAvatar } from './components/hlw-avatar/index';
|
|
7
|
-
export { default as HlwEmpty } from './components/hlw-empty/index';
|
|
8
|
-
export { default as HlwLoading } from './components/hlw-loading/index';
|
|
9
|
-
export { default as HlwMenuList
|
|
6
|
+
export { default as HlwAvatar } from './components/hlw-avatar/index.vue';
|
|
7
|
+
export { default as HlwEmpty } from './components/hlw-empty/index.vue';
|
|
8
|
+
export { default as HlwLoading } from './components/hlw-loading/index.vue';
|
|
9
|
+
export { default as HlwMenuList } from './components/hlw-menu-list/index.vue';
|
|
10
|
+
export type { MenuItem } from './components/hlw-menu-list/types';
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue';
|
|
2
|
-
|
|
3
|
-
export interface MenuItem {
|
|
4
|
-
key: string;
|
|
5
|
-
label: string;
|
|
6
|
-
icon?: string;
|
|
7
|
-
value?: string;
|
|
8
|
-
url?: string;
|
|
9
|
-
action?: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default defineComponent({
|
|
13
|
-
name: 'MenuList',
|
|
14
|
-
props: {
|
|
15
|
-
items: { type: Array as () => MenuItem[], required: true },
|
|
16
|
-
},
|
|
17
|
-
emits: ['click'],
|
|
18
|
-
setup(props, { emit }) {
|
|
19
|
-
function onTap(item: MenuItem) {
|
|
20
|
-
if (item.url) {
|
|
21
|
-
uni.navigateTo({ url: item.url });
|
|
22
|
-
} else if (item.action) {
|
|
23
|
-
item.action();
|
|
24
|
-
}
|
|
25
|
-
emit('click', item);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return () => {
|
|
29
|
-
const items = props.items.map((item) =>
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
h('view', {
|
|
32
|
-
class: 'hlw-menu-list__item',
|
|
33
|
-
key: item.key,
|
|
34
|
-
onClick: () => onTap(item),
|
|
35
|
-
}, [
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
h('view', { class: 'hlw-menu-list__left' }, [
|
|
38
|
-
item.icon
|
|
39
|
-
? (
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
h('text', { class: 'hlw-menu-list__icon' }, item.icon)
|
|
42
|
-
)
|
|
43
|
-
: null,
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
h('text', { class: 'hlw-menu-list__label' }, item.label),
|
|
46
|
-
]),
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
h('view', { class: 'hlw-menu-list__right' }, [
|
|
49
|
-
item.value
|
|
50
|
-
? (
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
h('text', { class: 'hlw-menu-list__value' }, item.value)
|
|
53
|
-
)
|
|
54
|
-
: null,
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
h('text', { class: 'hlw-menu-list__arrow' }, '›'),
|
|
57
|
-
]),
|
|
58
|
-
]),
|
|
59
|
-
);
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
return h('view', { class: 'hlw-menu-list' }, items);
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
});
|