@nutui/nutui 4.0.11 → 4.0.12
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/nutui.es.js +1 -1
- package/dist/nutui.js +2 -2
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +48 -48
- package/dist/styles/themes/jdb.scss +48 -48
- package/dist/styles/themes/jddkh.scss +48 -48
- package/dist/styles/themes/jdt.scss +48 -48
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -4
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { computed
|
|
2
|
-
import { c as
|
|
3
|
-
import { Loading1
|
|
4
|
-
import { _ as
|
|
1
|
+
import { computed, watch, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createVNode, createCommentVNode, Fragment, withDirectives, toDisplayString, vShow } from "vue";
|
|
2
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { Loading1 } from "@nutui/icons-vue";
|
|
4
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
5
5
|
import "../locale/lang";
|
|
6
|
-
const { componentName
|
|
7
|
-
|
|
6
|
+
const { componentName, create } = createComponent("switch");
|
|
7
|
+
const _sfc_main = create({
|
|
8
|
+
components: { Loading1 },
|
|
8
9
|
props: {
|
|
9
10
|
modelValue: {
|
|
10
11
|
type: [String, Number, Boolean],
|
|
11
|
-
default:
|
|
12
|
+
default: false
|
|
12
13
|
},
|
|
13
14
|
disable: {
|
|
14
15
|
type: Boolean,
|
|
15
|
-
default:
|
|
16
|
+
default: false
|
|
16
17
|
},
|
|
17
18
|
activeColor: {
|
|
18
19
|
type: String,
|
|
@@ -32,76 +33,88 @@ const { componentName: $, create: T } = S("switch"), A = T({
|
|
|
32
33
|
},
|
|
33
34
|
activeValue: {
|
|
34
35
|
type: [String, Number, Boolean],
|
|
35
|
-
default:
|
|
36
|
+
default: true
|
|
36
37
|
},
|
|
37
38
|
inactiveValue: {
|
|
38
39
|
type: [String, Number, Boolean],
|
|
39
|
-
default:
|
|
40
|
+
default: false
|
|
40
41
|
},
|
|
41
42
|
loading: {
|
|
42
43
|
type: Boolean,
|
|
43
|
-
default:
|
|
44
|
+
default: false
|
|
44
45
|
}
|
|
45
46
|
},
|
|
46
47
|
emits: ["change", "update:modelValue", "update:loading"],
|
|
47
|
-
setup(
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
setup(props, { emit }) {
|
|
49
|
+
const isActive = computed(() => props.modelValue === props.activeValue);
|
|
50
|
+
const classes = computed(() => {
|
|
51
|
+
const prefixCls = componentName;
|
|
50
52
|
return {
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[`${
|
|
54
|
-
[`${
|
|
53
|
+
[prefixCls]: true,
|
|
54
|
+
[isActive.value ? "nut-switch-open" : "nut-switch-close"]: true,
|
|
55
|
+
[`${prefixCls}-disable`]: props.disable,
|
|
56
|
+
[`${prefixCls}-base`]: true
|
|
55
57
|
};
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
});
|
|
59
|
+
const style = computed(() => {
|
|
60
|
+
return {
|
|
61
|
+
backgroundColor: isActive.value ? props.activeColor : props.inactiveColor
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
let updateType = "";
|
|
65
|
+
const onClick = (event) => {
|
|
66
|
+
if (props.disable || props.loading)
|
|
62
67
|
return;
|
|
63
|
-
const
|
|
64
|
-
|
|
68
|
+
const value = isActive.value ? props.inactiveValue : props.activeValue;
|
|
69
|
+
updateType = "click";
|
|
70
|
+
emit("update:modelValue", value);
|
|
71
|
+
emit("change", value, event);
|
|
65
72
|
};
|
|
66
|
-
|
|
67
|
-
() =>
|
|
68
|
-
(
|
|
69
|
-
|
|
73
|
+
watch(
|
|
74
|
+
() => props.modelValue,
|
|
75
|
+
(v) => {
|
|
76
|
+
if (updateType == "click") {
|
|
77
|
+
updateType = "";
|
|
78
|
+
} else {
|
|
79
|
+
emit("change", v);
|
|
80
|
+
}
|
|
70
81
|
}
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
);
|
|
83
|
+
return {
|
|
84
|
+
classes,
|
|
85
|
+
style,
|
|
86
|
+
isActive,
|
|
87
|
+
onClick
|
|
76
88
|
};
|
|
77
89
|
}
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
});
|
|
91
|
+
const _hoisted_1 = { class: "nut-switch-button" };
|
|
92
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
93
|
+
const _component_Loading1 = resolveComponent("Loading1");
|
|
94
|
+
return openBlock(), createElementBlock("view", {
|
|
95
|
+
class: normalizeClass(_ctx.classes),
|
|
96
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
|
|
97
|
+
style: normalizeStyle(_ctx.style)
|
|
85
98
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
createElementVNode("view", _hoisted_1, [
|
|
100
|
+
_ctx.loading ? renderSlot(_ctx.$slots, "icon", { key: 0 }, () => [
|
|
101
|
+
createVNode(_component_Loading1, {
|
|
89
102
|
name: "loading",
|
|
90
|
-
color:
|
|
103
|
+
color: _ctx.activeColor
|
|
91
104
|
}, null, 8, ["color"])
|
|
92
|
-
]) :
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
[
|
|
105
|
+
]) : createCommentVNode("", true),
|
|
106
|
+
_ctx.activeText ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
107
|
+
withDirectives(createElementVNode("view", { class: "nut-switch-label open" }, toDisplayString(_ctx.activeText), 513), [
|
|
108
|
+
[vShow, _ctx.isActive]
|
|
96
109
|
]),
|
|
97
|
-
|
|
98
|
-
[
|
|
110
|
+
withDirectives(createElementVNode("view", { class: "nut-switch-label close" }, toDisplayString(_ctx.inactiveText), 513), [
|
|
111
|
+
[vShow, !_ctx.isActive]
|
|
99
112
|
])
|
|
100
|
-
], 64)) :
|
|
113
|
+
], 64)) : createCommentVNode("", true)
|
|
101
114
|
])
|
|
102
115
|
], 6);
|
|
103
116
|
}
|
|
104
|
-
const
|
|
117
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
105
118
|
export {
|
|
106
|
-
|
|
119
|
+
index as default
|
|
107
120
|
};
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { inject, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } from "vue";
|
|
21
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
22
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
16
23
|
import "../locale/lang";
|
|
17
|
-
const { create
|
|
24
|
+
const { create } = createComponent("tab-pane");
|
|
25
|
+
const _sfc_main = create({
|
|
18
26
|
props: {
|
|
19
27
|
title: {
|
|
20
28
|
type: [String, Number],
|
|
@@ -26,28 +34,31 @@ const { create: g } = $("tab-pane"), k = g({
|
|
|
26
34
|
},
|
|
27
35
|
disabled: {
|
|
28
36
|
type: Boolean,
|
|
29
|
-
default:
|
|
37
|
+
default: false
|
|
30
38
|
}
|
|
31
39
|
},
|
|
32
40
|
emits: ["click"],
|
|
33
|
-
setup(
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
setup(props, { emit }) {
|
|
42
|
+
const parentOption = inject("tabsOpiton");
|
|
43
|
+
const paneStyle = computed(() => {
|
|
44
|
+
return {
|
|
45
|
+
display: parentOption.animatedTime.value == 0 && props.paneKey != parentOption.activeKey.value ? "none" : void 0
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
return __spreadProps(__spreadValues({}, parentOption), {
|
|
49
|
+
paneStyle
|
|
39
50
|
});
|
|
40
51
|
}
|
|
41
52
|
});
|
|
42
|
-
function
|
|
43
|
-
return
|
|
44
|
-
class:
|
|
45
|
-
style:
|
|
53
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
54
|
+
return openBlock(), createElementBlock("view", {
|
|
55
|
+
class: normalizeClass(["nut-tab-pane", { inactive: _ctx.paneKey != _ctx.activeKey && _ctx.autoHeight }]),
|
|
56
|
+
style: normalizeStyle(_ctx.paneStyle)
|
|
46
57
|
}, [
|
|
47
|
-
|
|
58
|
+
renderSlot(_ctx.$slots, "default")
|
|
48
59
|
], 6);
|
|
49
60
|
}
|
|
50
|
-
const
|
|
61
|
+
const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
51
62
|
export {
|
|
52
|
-
|
|
63
|
+
TabPane as default
|
|
53
64
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { toRefs
|
|
2
|
-
import { c as
|
|
3
|
-
import { _ as
|
|
1
|
+
import { toRefs, ref, reactive, provide, watch, onMounted, nextTick, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot } from "vue";
|
|
2
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
3
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
4
4
|
import "../locale/lang";
|
|
5
|
-
const { create
|
|
5
|
+
const { create } = createComponent("tabbar");
|
|
6
|
+
const _sfc_main = create({
|
|
6
7
|
props: {
|
|
7
8
|
modelValue: {
|
|
8
9
|
type: [Number, String],
|
|
@@ -10,7 +11,7 @@ const { create: k } = $("tabbar"), I = k({
|
|
|
10
11
|
},
|
|
11
12
|
bottom: {
|
|
12
13
|
type: Boolean,
|
|
13
|
-
default:
|
|
14
|
+
default: false
|
|
14
15
|
},
|
|
15
16
|
type: {
|
|
16
17
|
type: String,
|
|
@@ -26,60 +27,70 @@ const { create: k } = $("tabbar"), I = k({
|
|
|
26
27
|
},
|
|
27
28
|
safeAreaInsetBottom: {
|
|
28
29
|
type: Boolean,
|
|
29
|
-
default:
|
|
30
|
+
default: false
|
|
30
31
|
},
|
|
31
32
|
placeholder: {
|
|
32
33
|
type: Boolean,
|
|
33
|
-
default:
|
|
34
|
+
default: false
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
37
|
emits: ["tab-switch", "update:modelValue"],
|
|
37
|
-
setup(
|
|
38
|
-
const { bottom
|
|
39
|
-
|
|
38
|
+
setup(props, { emit, slots }) {
|
|
39
|
+
const { bottom, placeholder } = toRefs(props);
|
|
40
|
+
const height = ref();
|
|
41
|
+
const mdValue = reactive({
|
|
42
|
+
val: props.modelValue,
|
|
40
43
|
children: []
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
});
|
|
45
|
+
const nutTabbar = ref(null);
|
|
46
|
+
function changeIndex(index2, active) {
|
|
47
|
+
emit("update:modelValue", active);
|
|
48
|
+
parentData.modelValue = active;
|
|
49
|
+
emit("tab-switch", parentData.children[index2], active);
|
|
44
50
|
}
|
|
45
|
-
let
|
|
46
|
-
children:
|
|
47
|
-
modelValue:
|
|
48
|
-
unactiveColor:
|
|
49
|
-
activeColor:
|
|
50
|
-
changeIndex
|
|
51
|
+
let parentData = reactive({
|
|
52
|
+
children: mdValue.children,
|
|
53
|
+
modelValue: mdValue.val,
|
|
54
|
+
unactiveColor: props.unactiveColor,
|
|
55
|
+
activeColor: props.activeColor,
|
|
56
|
+
changeIndex
|
|
51
57
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
|
|
58
|
+
provide("parent", parentData);
|
|
59
|
+
watch(
|
|
60
|
+
() => props.modelValue,
|
|
61
|
+
(value) => {
|
|
62
|
+
parentData.modelValue = value;
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
onMounted(() => {
|
|
66
|
+
if (bottom.value && placeholder.value) {
|
|
67
|
+
nextTick(() => {
|
|
68
|
+
var _a;
|
|
69
|
+
height.value = (_a = nutTabbar == null ? void 0 : nutTabbar.value) == null ? void 0 : _a.getBoundingClientRect().height;
|
|
70
|
+
});
|
|
56
71
|
}
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}), {
|
|
63
|
-
changeIndex: c,
|
|
64
|
-
nutTabbar: a,
|
|
65
|
-
height: n
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
changeIndex,
|
|
75
|
+
nutTabbar,
|
|
76
|
+
height
|
|
66
77
|
};
|
|
67
78
|
}
|
|
68
79
|
});
|
|
69
|
-
function
|
|
70
|
-
return
|
|
71
|
-
class:
|
|
72
|
-
style:
|
|
80
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
81
|
+
return openBlock(), createElementBlock("div", {
|
|
82
|
+
class: normalizeClass({ "nut-tabbar__placeholder": _ctx.bottom && _ctx.placeholder }),
|
|
83
|
+
style: normalizeStyle({ height: _ctx.height + "px" })
|
|
73
84
|
}, [
|
|
74
|
-
|
|
85
|
+
createElementVNode("view", {
|
|
75
86
|
ref: "nutTabbar",
|
|
76
|
-
class:
|
|
87
|
+
class: normalizeClass(["nut-tabbar", { "nut-tabbar-bottom": _ctx.bottom, "nut-tabbar-safebottom": _ctx.safeAreaInsetBottom }])
|
|
77
88
|
}, [
|
|
78
|
-
|
|
89
|
+
renderSlot(_ctx.$slots, "default")
|
|
79
90
|
], 2)
|
|
80
91
|
], 6);
|
|
81
92
|
}
|
|
82
|
-
const
|
|
93
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
83
94
|
export {
|
|
84
|
-
|
|
95
|
+
index as default
|
|
85
96
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { r as
|
|
3
|
-
import { inject
|
|
4
|
-
import { u as
|
|
5
|
-
import
|
|
6
|
-
import { _ as
|
|
1
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
2
|
+
import { r as renderIcon } from "./renderIcon-3d0fd47c.js";
|
|
3
|
+
import { inject, reactive, getCurrentInstance, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, normalizeProps, guardReactiveProps, withCtx, createElementVNode, renderSlot, createCommentVNode, createBlock, resolveDynamicComponent, toDisplayString } from "vue";
|
|
4
|
+
import { u as useRouter } from "./index-54d03fc1.js";
|
|
5
|
+
import Badge from "./Badge.js";
|
|
6
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
7
7
|
import "../locale/lang";
|
|
8
|
-
const { create
|
|
9
|
-
|
|
8
|
+
const { create } = createComponent("tabbar-item");
|
|
9
|
+
const _sfc_main = create({
|
|
10
|
+
components: { [Badge.name]: Badge },
|
|
10
11
|
props: {
|
|
11
12
|
tabTitle: {
|
|
12
13
|
// 标签页的标题
|
|
@@ -27,75 +28,95 @@ const { create: A } = k("tabbar-item"), F = A({
|
|
|
27
28
|
},
|
|
28
29
|
to: [Object, String]
|
|
29
30
|
},
|
|
30
|
-
setup(
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
setup(props, { emit, slots }) {
|
|
32
|
+
const isHaveSlot = (slot) => {
|
|
33
|
+
return slots[slot];
|
|
34
|
+
};
|
|
35
|
+
const parent = inject("parent");
|
|
36
|
+
const state = reactive({
|
|
37
|
+
unactiveColor: parent.unactiveColor,
|
|
33
38
|
// 未选中的颜色
|
|
34
|
-
activeColor:
|
|
39
|
+
activeColor: parent.activeColor,
|
|
35
40
|
// 选中的颜色
|
|
36
41
|
index: 0
|
|
37
|
-
})
|
|
38
|
-
(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
});
|
|
43
|
+
const router = useRouter();
|
|
44
|
+
const relation = (child) => {
|
|
45
|
+
var _a;
|
|
46
|
+
if (child.proxy) {
|
|
47
|
+
parent.children.push(child.proxy);
|
|
48
|
+
const index2 = parent.children.indexOf(child.proxy);
|
|
49
|
+
state.index = (_a = props.name) != null ? _a : index2;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
relation(getCurrentInstance());
|
|
53
|
+
const active = computed(() => state.index === parent.modelValue);
|
|
54
|
+
function change() {
|
|
55
|
+
var _a, _b, _c;
|
|
56
|
+
let key = (_a = props.name) != null ? _a : state.index;
|
|
57
|
+
let indexValue = null;
|
|
58
|
+
if (props.name) {
|
|
59
|
+
indexValue = parent.children.findIndex((item) => {
|
|
60
|
+
return item.name == key;
|
|
61
|
+
});
|
|
44
62
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
let n = (v = e.name) != null ? v : i.index, o = null;
|
|
50
|
-
e.name && (o = t.children.findIndex((a) => a.name == n)), t.changeIndex(o != null ? o : n, i.index);
|
|
51
|
-
let r = o != null ? o : n;
|
|
52
|
-
if ((f = t.children[r]) != null && f.href) {
|
|
53
|
-
window.location.href = t.children[r].href;
|
|
63
|
+
parent.changeIndex(indexValue != null ? indexValue : key, state.index);
|
|
64
|
+
let index2 = indexValue != null ? indexValue : key;
|
|
65
|
+
if ((_b = parent.children[index2]) == null ? void 0 : _b.href) {
|
|
66
|
+
window.location.href = parent.children[index2].href;
|
|
54
67
|
return;
|
|
55
68
|
}
|
|
56
|
-
if ((
|
|
57
|
-
let
|
|
58
|
-
|
|
69
|
+
if ((_c = parent.children[index2]) == null ? void 0 : _c.to) {
|
|
70
|
+
let to = parent.children[index2].to;
|
|
71
|
+
if (to && router) {
|
|
72
|
+
router.push(to);
|
|
73
|
+
} else {
|
|
74
|
+
location.replace(to);
|
|
75
|
+
}
|
|
59
76
|
}
|
|
60
77
|
}
|
|
61
78
|
return {
|
|
62
|
-
state
|
|
63
|
-
active
|
|
64
|
-
renderIcon
|
|
65
|
-
isHaveSlot
|
|
66
|
-
change
|
|
79
|
+
state,
|
|
80
|
+
active,
|
|
81
|
+
renderIcon,
|
|
82
|
+
isHaveSlot,
|
|
83
|
+
change
|
|
67
84
|
};
|
|
68
85
|
}
|
|
69
|
-
})
|
|
86
|
+
});
|
|
87
|
+
const _hoisted_1 = { class: "nut-tabbar-item_icon-box" };
|
|
88
|
+
const _hoisted_2 = {
|
|
70
89
|
key: 0,
|
|
71
90
|
class: "nut-tabbar-item_icon-box_icon"
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
};
|
|
92
|
+
const _hoisted_3 = { key: 1 };
|
|
93
|
+
const _hoisted_4 = { key: 0 };
|
|
94
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
95
|
+
const _component_nut_badge = resolveComponent("nut-badge");
|
|
96
|
+
return openBlock(), createElementBlock("div", {
|
|
97
|
+
class: normalizeClass(["nut-tabbar-item", { "nut-tabbar-item__icon--unactive": !_ctx.active }]),
|
|
98
|
+
style: normalizeStyle({
|
|
99
|
+
color: _ctx.active ? _ctx.state.activeColor : _ctx.state.unactiveColor
|
|
79
100
|
}),
|
|
80
|
-
onClick:
|
|
101
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.change())
|
|
81
102
|
}, [
|
|
82
|
-
|
|
83
|
-
default:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
])) :
|
|
88
|
-
|
|
89
|
-
(
|
|
90
|
-
])) :
|
|
91
|
-
|
|
92
|
-
class:
|
|
103
|
+
createVNode(_component_nut_badge, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
|
104
|
+
default: withCtx(() => [
|
|
105
|
+
createElementVNode("view", _hoisted_1, [
|
|
106
|
+
_ctx.isHaveSlot("icon") ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
107
|
+
renderSlot(_ctx.$slots, "icon", { active: _ctx.active })
|
|
108
|
+
])) : createCommentVNode("", true),
|
|
109
|
+
_ctx.icon && !_ctx.isHaveSlot("icon") ? (openBlock(), createElementBlock("view", _hoisted_3, [
|
|
110
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.renderIcon(_ctx.icon)), { class: "nut-popover-item-img" }))
|
|
111
|
+
])) : createCommentVNode("", true),
|
|
112
|
+
createElementVNode("view", {
|
|
113
|
+
class: normalizeClass([
|
|
93
114
|
"nut-tabbar-item_icon-box_nav-word",
|
|
94
|
-
{ "nut-tabbar-item_icon-box_big-word": !
|
|
115
|
+
{ "nut-tabbar-item_icon-box_big-word": !_ctx.icon && !_ctx.isHaveSlot("icon") }
|
|
95
116
|
])
|
|
96
117
|
}, [
|
|
97
|
-
|
|
98
|
-
|
|
118
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
119
|
+
_ctx.tabTitle ? (openBlock(), createElementBlock("view", _hoisted_4, toDisplayString(_ctx.tabTitle), 1)) : createCommentVNode("", true)
|
|
99
120
|
])
|
|
100
121
|
], 2)
|
|
101
122
|
])
|
|
@@ -104,7 +125,7 @@ function M(e, m, u, p, t, i) {
|
|
|
104
125
|
}, 16)
|
|
105
126
|
], 6);
|
|
106
127
|
}
|
|
107
|
-
const
|
|
128
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
108
129
|
export {
|
|
109
|
-
|
|
130
|
+
index as default
|
|
110
131
|
};
|