@nutui/nutui 3.1.6 → 3.1.7

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/nutui.d.ts +7 -1
  3. package/dist/nutui.es.js +1097 -517
  4. package/dist/nutui.umd.js +1158 -571
  5. package/dist/packages/_es/ActionSheet.js +158 -0
  6. package/dist/packages/_es/Address.js +525 -0
  7. package/dist/packages/_es/Avatar.js +87 -0
  8. package/dist/packages/_es/BackTop.js +159 -0
  9. package/dist/packages/_es/Badge.js +90 -0
  10. package/dist/packages/_es/Barrage.js +118 -0
  11. package/dist/packages/_es/Button.js +124 -0
  12. package/dist/packages/_es/Calendar.js +700 -0
  13. package/dist/packages/_es/Cell.js +95 -0
  14. package/dist/packages/_es/CellGroup.js +42 -0
  15. package/dist/packages/_es/Checkbox.js +109 -0
  16. package/dist/packages/_es/CheckboxGroup.js +62 -0
  17. package/dist/packages/_es/CircleProgress.js +109 -0
  18. package/dist/packages/_es/Col.js +53 -0
  19. package/dist/packages/_es/Collapse.js +89 -0
  20. package/dist/packages/_es/CollapseItem.js +257 -0
  21. package/dist/packages/_es/CountDown.js +224 -0
  22. package/dist/packages/_es/CountUp.js +547 -0
  23. package/dist/packages/_es/DatePicker.js +282 -0
  24. package/dist/packages/_es/Dialog.js +313 -0
  25. package/dist/packages/_es/Divider.js +49 -0
  26. package/dist/packages/_es/Drag.js +198 -0
  27. package/dist/packages/_es/Elevator.js +207 -0
  28. package/dist/packages/_es/FixedNav.js +127 -0
  29. package/dist/packages/_es/Icon.js +44 -0
  30. package/dist/packages/_es/ImagePreview.js +109 -0
  31. package/dist/packages/_es/InfiniteLoading.js +265 -0
  32. package/dist/packages/_es/Input.js +183 -0
  33. package/dist/packages/_es/InputNumber.js +172 -0
  34. package/dist/packages/_es/Layout.js +10 -0
  35. package/dist/packages/_es/MenuItem.js +180 -0
  36. package/dist/packages/_es/Navbar.js +160 -0
  37. package/dist/packages/_es/NoticeBar.js +389 -0
  38. package/dist/packages/_es/Notify.js +233 -0
  39. package/dist/packages/_es/NumberKeyboard.js +248 -0
  40. package/dist/packages/_es/OverLay.js +118 -0
  41. package/dist/packages/_es/Pagination.js +163 -0
  42. package/dist/packages/_es/Picker.js +485 -0
  43. package/dist/packages/_es/Popover.js +157 -0
  44. package/dist/packages/_es/Popup.js +268 -0
  45. package/dist/packages/_es/Price.js +104 -0
  46. package/dist/packages/_es/Progress.js +131 -0
  47. package/dist/packages/_es/Radio.js +72 -0
  48. package/dist/packages/_es/RadioGroup.js +37 -0
  49. package/dist/packages/_es/Range.js +350 -0
  50. package/dist/packages/_es/Rate.js +129 -0
  51. package/dist/packages/_es/Row.js +61 -0
  52. package/dist/packages/_es/ShortPassword.js +221 -0
  53. package/dist/packages/_es/Signature.js +167 -0
  54. package/dist/packages/_es/Step.js +116 -0
  55. package/dist/packages/_es/Steps.js +52 -0
  56. package/dist/packages/_es/Swipe.js +193 -0
  57. package/dist/packages/_es/Swiper.js +429 -0
  58. package/dist/packages/_es/SwiperItem.js +60 -0
  59. package/dist/packages/_es/Switch.js +90 -0
  60. package/dist/packages/_es/Tab.js +179 -0
  61. package/dist/packages/_es/TabPane.js +42 -0
  62. package/dist/packages/_es/TabPanel.js +30 -0
  63. package/dist/packages/_es/Tabbar.js +73 -0
  64. package/dist/packages/_es/TabbarItem.js +142 -0
  65. package/dist/packages/_es/Tag.js +98 -0
  66. package/dist/packages/_es/TextArea.js +127 -0
  67. package/dist/packages/_es/Toast.js +317 -0
  68. package/dist/packages/_es/Uploader.js +400 -0
  69. package/dist/packages/_es/Video.js +405 -0
  70. package/dist/packages/_es/component.js +26 -0
  71. package/dist/packages/_es/index.js +64 -0
  72. package/dist/packages/_es/index2.js +13 -0
  73. package/dist/packages/_es/plugin-vue_export-helper.js +12 -0
  74. package/dist/packages/_es/pxCheck.js +9 -0
  75. package/dist/packages/_es/raf.js +19 -0
  76. package/dist/packages/avatar/index.scss +0 -1
  77. package/dist/packages/badge/index.scss +35 -0
  78. package/dist/packages/calendar/index.scss +13 -0
  79. package/dist/packages/imagepreview/index.scss +48 -0
  80. package/dist/packages/input/index.scss +14 -7
  81. package/dist/packages/pagination/index.scss +51 -0
  82. package/dist/packages/popover/index.scss +159 -0
  83. package/dist/packages/shortpassword/index.scss +19 -7
  84. package/dist/packages/tabpane/index.scss +1 -0
  85. package/dist/packages/tabs/index.scss +1 -0
  86. package/dist/packages/tag/index.scss +47 -0
  87. package/dist/packages/uploader/index.scss +0 -1
  88. package/dist/style.css +1 -1
  89. package/dist/style.es.js +2 -1
  90. package/dist/styles/themes/default.scss +35 -28
  91. package/dist/styles/variables.scss +55 -32
  92. package/package.json +7 -7
@@ -0,0 +1,90 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, withDirectives, vShow, Fragment, toDisplayString, createCommentVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { componentName, create } = createComponent("switch");
10
+ const _sfc_main = create({
11
+ props: {
12
+ modelValue: {
13
+ type: Boolean,
14
+ default: false
15
+ },
16
+ disable: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ activeColor: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ inactiveColor: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ activeText: {
29
+ type: String,
30
+ default: ""
31
+ },
32
+ inactiveText: {
33
+ type: String,
34
+ default: ""
35
+ }
36
+ },
37
+ emits: ["change", "update:modelValue"],
38
+ setup(props, { emit }) {
39
+ const classes = computed(() => {
40
+ const prefixCls = componentName;
41
+ return {
42
+ [prefixCls]: true,
43
+ [props.modelValue ? "switch-open" : "switch-close"]: true,
44
+ [`${prefixCls}-disable`]: props.disable,
45
+ [`${prefixCls}-base`]: true
46
+ };
47
+ });
48
+ const style = computed(() => {
49
+ return {
50
+ backgroundColor: props.modelValue ? props.activeColor : props.inactiveColor
51
+ };
52
+ });
53
+ const onClick = (event) => {
54
+ if (props.disable)
55
+ return;
56
+ emit("update:modelValue", !props.modelValue);
57
+ emit("change", !props.modelValue, event);
58
+ };
59
+ return {
60
+ classes,
61
+ style,
62
+ onClick
63
+ };
64
+ }
65
+ });
66
+ const _hoisted_1 = { class: "switch-button" };
67
+ const _hoisted_2 = { class: "close-line" };
68
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
69
+ return openBlock(), createElementBlock("view", {
70
+ class: normalizeClass(_ctx.classes),
71
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
72
+ style: normalizeStyle(_ctx.style)
73
+ }, [
74
+ createElementVNode("view", _hoisted_1, [
75
+ withDirectives(createElementVNode("view", _hoisted_2, null, 512), [
76
+ [vShow, !_ctx.modelValue]
77
+ ]),
78
+ _ctx.activeText ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
79
+ withDirectives(createElementVNode("view", { class: "nut-switch-label open" }, toDisplayString(_ctx.activeText), 513), [
80
+ [vShow, _ctx.modelValue]
81
+ ]),
82
+ withDirectives(createElementVNode("view", { class: "nut-switch-label close" }, toDisplayString(_ctx.inactiveText), 513), [
83
+ [vShow, !_ctx.modelValue]
84
+ ])
85
+ ], 64)) : createCommentVNode("", true)
86
+ ])
87
+ ], 6);
88
+ }
89
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
90
+ export { index as default };
@@ -0,0 +1,179 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { h, reactive, ref, onMounted, watch, watchEffect, resolveComponent, openBlock, createElementBlock, createElementVNode, normalizeClass, Fragment, renderList, toDisplayString, createBlock, createCommentVNode, createVNode, withCtx, renderSlot } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ var TabTitle = {
10
+ setup(props) {
11
+ return () => h(`view`, {}, props.slots);
12
+ },
13
+ props: {
14
+ slots: Object
15
+ }
16
+ };
17
+ const { create } = createComponent("tab");
18
+ const _sfc_main = create({
19
+ props: {
20
+ defaultIndex: {
21
+ type: Number,
22
+ default: 0
23
+ },
24
+ animatedTime: {
25
+ type: Number,
26
+ default: 0
27
+ },
28
+ direction: {
29
+ type: String,
30
+ default: "horizontal"
31
+ },
32
+ noSwiping: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ scrollType: {
37
+ type: String,
38
+ default: "flex"
39
+ },
40
+ iconType: {
41
+ type: String,
42
+ default: "all"
43
+ }
44
+ },
45
+ components: {
46
+ TabTitle
47
+ },
48
+ emits: ["switch-tab"],
49
+ setup(props, ctx) {
50
+ const titles = reactive([]);
51
+ ref(false);
52
+ const activeIndex = ref(props.defaultIndex);
53
+ const navlist = ref(null);
54
+ const nutuiSwiper = ref(null);
55
+ function createHash() {
56
+ return Array.from(Array(10), () => Math.floor(Math.random() * 36).toString(36)).join("");
57
+ }
58
+ const swiperClassName = ref("swiper-" + createHash());
59
+ function centerTitle(index2) {
60
+ if (navlist.value) {
61
+ const currEle = navlist.value.querySelectorAll(".tab-title-box")[index2];
62
+ if (props.direction === "vertical") {
63
+ const currTitleTop = navlist.value.offsetTop;
64
+ const currTop = currEle.offsetTop;
65
+ const currHeight = currEle.offsetHeight;
66
+ const tapHeight = navlist.value.offsetHeight;
67
+ navlist.value.scroll(0, currTop - currTitleTop - tapHeight / 2 + currHeight / 2);
68
+ } else {
69
+ const currLeft = currEle.offsetLeft;
70
+ const currWidth = currEle.offsetWidth;
71
+ const tapWidth = navlist.value.offsetWidth;
72
+ navlist.value.scroll(currLeft - tapWidth / 2 + currWidth / 2, 0);
73
+ }
74
+ }
75
+ }
76
+ const changeTab = (index2) => {
77
+ activeIndex.value = index2;
78
+ centerTitle(index2);
79
+ };
80
+ function switchTitle(index2) {
81
+ activeIndex.value = index2;
82
+ centerTitle(index2);
83
+ nutuiSwiper.value.to(index2);
84
+ }
85
+ function initTitle() {
86
+ titles.length = 0;
87
+ if (ctx.slots.default) {
88
+ const slots = ctx.slots.default().length === 1 ? ctx.slots.default()[0].children : ctx.slots.default();
89
+ slots && slots.map((item, index2) => {
90
+ if (typeof item.children == "string")
91
+ return;
92
+ titles.push({
93
+ title: item.props && item.props["tab-title"] ? item.props["tab-title"] : "",
94
+ content: item.children && item.children.header ? item.children.header() : null
95
+ });
96
+ });
97
+ }
98
+ }
99
+ onMounted(() => {
100
+ initTitle();
101
+ });
102
+ watch(() => ctx.slots.default(), (val, oldVal) => {
103
+ if (val) {
104
+ ctx.slots.default();
105
+ initTitle();
106
+ }
107
+ });
108
+ watchEffect(() => {
109
+ activeIndex.value = props.defaultIndex;
110
+ });
111
+ watch(() => activeIndex.value, (val, oldVal) => {
112
+ ctx.emit("switch-tab", activeIndex.value);
113
+ });
114
+ return {
115
+ swiperClassName,
116
+ titles,
117
+ navlist,
118
+ activeIndex,
119
+ switchTitle,
120
+ changeTab,
121
+ nutuiSwiper
122
+ };
123
+ }
124
+ });
125
+ const _hoisted_1 = { class: "nutui-tab" };
126
+ const _hoisted_2 = ["onClick"];
127
+ const _hoisted_3 = { class: "world" };
128
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("view", { class: "underline" }, null, -1);
129
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
130
+ const _component_TabTitle = resolveComponent("TabTitle");
131
+ const _component_nut_swiper = resolveComponent("nut-swiper");
132
+ return openBlock(), createElementBlock("view", _hoisted_1, [
133
+ createElementVNode("view", {
134
+ class: normalizeClass([_ctx.direction === "vertical" ? "vertical-tab" : "horizontal-tab"])
135
+ }, [
136
+ createElementVNode("view", {
137
+ class: normalizeClass(["tab-title", _ctx.iconType, "tab-title-scroll"]),
138
+ ref: "navlist"
139
+ }, [
140
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.titles, (item, index2) => {
141
+ return openBlock(), createElementBlock("view", {
142
+ class: normalizeClass([
143
+ "tab-title-box",
144
+ { "nut-tab-active": _ctx.activeIndex == index2 },
145
+ { "tab-title-box-scroll": _ctx.scrollType == "scroll" }
146
+ ]),
147
+ key: index2,
148
+ onClick: ($event) => _ctx.switchTitle(index2, $event)
149
+ }, [
150
+ createElementVNode("span", _hoisted_3, toDisplayString(item.title), 1),
151
+ item.content ? (openBlock(), createBlock(_component_TabTitle, {
152
+ key: 0,
153
+ slots: item.content
154
+ }, null, 8, ["slots"])) : createCommentVNode("", true)
155
+ ], 10, _hoisted_2);
156
+ }), 128)),
157
+ _hoisted_4
158
+ ], 2),
159
+ createVNode(_component_nut_swiper, {
160
+ "init-page": _ctx.defaultIndex,
161
+ "pagination-visible": false,
162
+ duration: _ctx.animatedTime,
163
+ "pagination-color": "#426543",
164
+ onChange: _ctx.changeTab,
165
+ ref: "nutuiSwiper",
166
+ touchable: !_ctx.noSwiping,
167
+ direction: _ctx.direction,
168
+ class: "tab-swiper"
169
+ }, {
170
+ default: withCtx(() => [
171
+ renderSlot(_ctx.$slots, "default")
172
+ ]),
173
+ _: 3
174
+ }, 8, ["init-page", "duration", "onChange", "touchable", "direction"])
175
+ ], 2)
176
+ ]);
177
+ }
178
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
179
+ export { index as default };
@@ -0,0 +1,42 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { componentName, create } = createComponent("tabpane");
10
+ const _sfc_main = create({
11
+ props: {
12
+ name: {
13
+ type: String,
14
+ default: ""
15
+ },
16
+ txt: {
17
+ type: String,
18
+ default: ""
19
+ }
20
+ },
21
+ components: {},
22
+ emits: ["click"],
23
+ setup(props, { emit }) {
24
+ console.log("componentName", componentName);
25
+ const { name, txt } = toRefs(props);
26
+ const handleClick = (event) => {
27
+ emit("click", event);
28
+ };
29
+ return { name, txt, handleClick };
30
+ }
31
+ });
32
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
33
+ return openBlock(), createElementBlock("view", {
34
+ class: normalizeClass(_ctx.classes),
35
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
36
+ }, [
37
+ createElementVNode("view", null, toDisplayString(_ctx.name), 1),
38
+ createElementVNode("view", null, toDisplayString(_ctx.txt), 1)
39
+ ], 2);
40
+ }
41
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
42
+ export { index as default };
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { c as createComponent } from "./component.js";
7
+ import { resolveComponent, openBlock, createBlock, withCtx, renderSlot } from "vue";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { create } = createComponent("tab-panel");
10
+ const _sfc_main = create({
11
+ props: {
12
+ tabTitle: {
13
+ type: String,
14
+ default: ""
15
+ }
16
+ },
17
+ setup(props, ctx) {
18
+ }
19
+ });
20
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
21
+ const _component_nut_swiper_item = resolveComponent("nut-swiper-item");
22
+ return openBlock(), createBlock(_component_nut_swiper_item, null, {
23
+ default: withCtx(() => [
24
+ renderSlot(_ctx.$slots, "default")
25
+ ]),
26
+ _: 3
27
+ });
28
+ }
29
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
30
+ export { index as default };
@@ -0,0 +1,73 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { reactive, provide, watch, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { create } = createComponent("tabbar");
10
+ const _sfc_main = create({
11
+ props: {
12
+ visible: {
13
+ type: [Number, String],
14
+ default: 0
15
+ },
16
+ bottom: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ type: {
21
+ type: String,
22
+ default: "base"
23
+ },
24
+ size: {
25
+ type: String,
26
+ default: "20px"
27
+ },
28
+ unactiveColor: {
29
+ type: String,
30
+ default: "#000000"
31
+ },
32
+ activeColor: {
33
+ type: String,
34
+ default: ""
35
+ }
36
+ },
37
+ emits: ["tab-switch", "update:visible"],
38
+ setup(props, { emit, slots }) {
39
+ const mdValue = reactive({
40
+ val: props.visible,
41
+ children: []
42
+ });
43
+ function changeIndex(active) {
44
+ emit("update:visible", active);
45
+ parentData.modelValue = active;
46
+ emit("tab-switch", parentData.children[active], active);
47
+ }
48
+ let parentData = reactive({
49
+ children: mdValue.children,
50
+ size: props.size,
51
+ modelValue: mdValue.val,
52
+ unactiveColor: props.unactiveColor,
53
+ activeColor: props.activeColor,
54
+ changeIndex
55
+ });
56
+ provide("parent", parentData);
57
+ watch(() => props.visible, (value) => {
58
+ parentData.modelValue = value;
59
+ });
60
+ return {
61
+ changeIndex
62
+ };
63
+ }
64
+ });
65
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
66
+ return openBlock(), createElementBlock("view", {
67
+ class: normalizeClass(["nut-tabbar", { "nut-tabbar-bottom": _ctx.bottom }])
68
+ }, [
69
+ renderSlot(_ctx.$slots, "default")
70
+ ], 2);
71
+ }
72
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
73
+ export { index as default };
@@ -0,0 +1,142 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { c as createComponent } from "./component.js";
7
+ import { useRouter } from "vue-router";
8
+ import { inject, reactive, getCurrentInstance, computed, watch, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, toDisplayString, createCommentVNode, createVNode } from "vue";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
+ const { create } = createComponent("tabbar-item");
11
+ const _sfc_main = create({
12
+ props: {
13
+ tabTitle: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ icon: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ href: {
22
+ type: String,
23
+ default: ""
24
+ },
25
+ num: {
26
+ type: String,
27
+ default: ""
28
+ },
29
+ activeImg: {
30
+ type: String,
31
+ default: ""
32
+ },
33
+ img: {
34
+ type: String,
35
+ default: ""
36
+ },
37
+ classPrefix: {
38
+ type: String,
39
+ default: "nut-icon"
40
+ },
41
+ fontClassName: {
42
+ type: String,
43
+ default: "nutui-iconfont"
44
+ },
45
+ to: [Object, String]
46
+ },
47
+ setup(props, ctx) {
48
+ const parent = inject("parent");
49
+ const state = reactive({
50
+ size: parent.size,
51
+ unactiveColor: parent.unactiveColor,
52
+ activeColor: parent.activeColor,
53
+ active: parent.modelValue,
54
+ index: 0
55
+ });
56
+ const router = useRouter();
57
+ const relation = (child) => {
58
+ if (child.proxy) {
59
+ let index2 = parent.children.length;
60
+ state.index = index2;
61
+ let obj = Object.assign({}, child.proxy, { index: index2 });
62
+ parent.children.push(obj);
63
+ }
64
+ };
65
+ relation(getCurrentInstance());
66
+ function change(index2) {
67
+ parent.changeIndex(index2);
68
+ }
69
+ const choosed = computed(() => {
70
+ if (parent) {
71
+ return parent.modelValue;
72
+ }
73
+ return null;
74
+ });
75
+ watch(choosed, (value, oldValue) => {
76
+ state.active = value;
77
+ setTimeout(() => {
78
+ if (parent.children[value].href) {
79
+ window.location.href = parent.children[value].href;
80
+ }
81
+ if (parent.children[value].to) {
82
+ let to = parent.children[value].to;
83
+ router.push(to);
84
+ }
85
+ });
86
+ });
87
+ return {
88
+ state,
89
+ change
90
+ };
91
+ }
92
+ });
93
+ const _hoisted_1 = { class: "nut-tabbar-item_icon-box" };
94
+ const _hoisted_2 = {
95
+ key: 0,
96
+ class: "nut-tabbar-item_icon-box_tips nut-tabbar-item_icon-box_num"
97
+ };
98
+ const _hoisted_3 = {
99
+ key: 1,
100
+ class: "nut-tabbar-item_icon-box_tips nut-tabbar-item_icon-box_nums"
101
+ };
102
+ const _hoisted_4 = { key: 2 };
103
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
104
+ const _component_nut_icon = resolveComponent("nut-icon");
105
+ return openBlock(), createElementBlock("div", {
106
+ class: normalizeClass(["nut-tabbar-item", { "nut-tabbar-item__icon--unactive": _ctx.state.active != _ctx.state.index }]),
107
+ style: normalizeStyle({
108
+ color: _ctx.state.active == _ctx.state.index ? _ctx.state.activeColor : _ctx.state.unactiveColor
109
+ }),
110
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.change(_ctx.state.index))
111
+ }, [
112
+ createElementVNode("view", _hoisted_1, [
113
+ _ctx.num && _ctx.num <= 99 ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.num), 1)) : _ctx.num && _ctx.num > 100 ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString("99+"))) : createCommentVNode("", true),
114
+ _ctx.icon ? (openBlock(), createElementBlock("view", _hoisted_4, [
115
+ createVNode(_component_nut_icon, {
116
+ class: "nut-tabbar-item_icon-box_icon",
117
+ size: _ctx.state.size,
118
+ name: _ctx.icon,
119
+ "font-class-name": _ctx.fontClassName,
120
+ "class-prefix": _ctx.classPrefix
121
+ }, null, 8, ["size", "name", "font-class-name", "class-prefix"])
122
+ ])) : createCommentVNode("", true),
123
+ !_ctx.icon && _ctx.activeImg ? (openBlock(), createElementBlock("div", {
124
+ key: 3,
125
+ class: "nut-tabbar-item_icon-box_icon",
126
+ style: normalizeStyle({
127
+ backgroundImage: `url(${_ctx.state.active == _ctx.state.index ? _ctx.activeImg : _ctx.img})`,
128
+ width: _ctx.state.size,
129
+ height: _ctx.state.size
130
+ })
131
+ }, null, 4)) : createCommentVNode("", true),
132
+ createElementVNode("view", {
133
+ class: normalizeClass([
134
+ "nut-tabbar-item_icon-box_nav-word",
135
+ { "nut-tabbar-item_icon-box_big-word": !_ctx.icon && !_ctx.activeImg }
136
+ ])
137
+ }, toDisplayString(_ctx.tabTitle), 3)
138
+ ])
139
+ ], 6);
140
+ }
141
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
142
+ export { index as default };
@@ -0,0 +1,98 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { toRefs, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createBlock, createCommentVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { componentName, create } = createComponent("tag");
10
+ const _sfc_main = create({
11
+ props: {
12
+ color: String,
13
+ textColor: String,
14
+ type: {
15
+ type: String,
16
+ default: "default"
17
+ },
18
+ plain: {
19
+ type: Boolean,
20
+ default: false
21
+ },
22
+ round: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ mark: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ closeable: {
31
+ type: Boolean,
32
+ default: false
33
+ }
34
+ },
35
+ emits: ["close"],
36
+ setup(props, { emit }) {
37
+ const { type, color, plain, round, mark, textColor } = toRefs(props);
38
+ const classes = computed(() => {
39
+ const prefixCls = componentName;
40
+ return {
41
+ [prefixCls]: true,
42
+ [`${prefixCls}--${type.value}`]: type.value,
43
+ [`${prefixCls}--plain`]: plain.value,
44
+ [`${prefixCls}--round`]: round.value,
45
+ [`${prefixCls}--mark`]: mark.value
46
+ };
47
+ });
48
+ const getStyle = () => {
49
+ if (color == null ? void 0 : color.value) {
50
+ return {
51
+ background: color.value,
52
+ color: textColor.value
53
+ };
54
+ }
55
+ if (plain.value) {
56
+ return {
57
+ color: "#FA2400",
58
+ background: "#fff",
59
+ border: "1px solid rgba(250,36,0,1)"
60
+ };
61
+ }
62
+ return {
63
+ color: "",
64
+ background: ""
65
+ };
66
+ };
67
+ const onClose = (event) => {
68
+ event.stopPropagation();
69
+ emit("close", event);
70
+ };
71
+ return {
72
+ classes,
73
+ getStyle,
74
+ onClose
75
+ };
76
+ }
77
+ });
78
+ const _hoisted_1 = { class: "nut-tag" };
79
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
80
+ const _component_nut_icon = resolveComponent("nut-icon");
81
+ return openBlock(), createElementBlock("view", {
82
+ class: normalizeClass(_ctx.classes),
83
+ style: normalizeStyle(_ctx.getStyle())
84
+ }, [
85
+ createElementVNode("view", _hoisted_1, [
86
+ renderSlot(_ctx.$slots, "default"),
87
+ _ctx.closeable ? (openBlock(), createBlock(_component_nut_icon, {
88
+ key: 0,
89
+ class: "nut-tag--close",
90
+ name: "close",
91
+ size: "12",
92
+ onClick: _ctx.onClose
93
+ }, null, 8, ["onClick"])) : createCommentVNode("", true)
94
+ ])
95
+ ], 6);
96
+ }
97
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
98
+ export { index as default };