vdesign-ui 0.2.8 → 0.2.9

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.
@@ -432,14 +432,10 @@ module.exports = typeof documentAll == 'undefined' && documentAll !== undefined
432
432
 
433
433
  /***/ }),
434
434
 
435
- /***/ "1925":
436
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
437
-
438
- "use strict";
439
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_430e7741_prod_lang_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("9afc");
440
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_430e7741_prod_lang_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_430e7741_prod_lang_less__WEBPACK_IMPORTED_MODULE_0__);
441
- /* unused harmony reexport * */
435
+ /***/ "177f":
436
+ /***/ (function(module, exports, __webpack_require__) {
442
437
 
438
+ // extracted by mini-css-extract-plugin
443
439
 
444
440
  /***/ }),
445
441
 
@@ -530,6 +526,17 @@ module.exports = function (it) {
530
526
  /* unused harmony reexport * */
531
527
 
532
528
 
529
+ /***/ }),
530
+
531
+ /***/ "230a":
532
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
533
+
534
+ "use strict";
535
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_6cfdbc71_prod_lang_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("177f");
536
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_6cfdbc71_prod_lang_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_11_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_less_loader_dist_cjs_js_ref_11_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_6cfdbc71_prod_lang_less__WEBPACK_IMPORTED_MODULE_0__);
537
+ /* unused harmony reexport * */
538
+
539
+
533
540
  /***/ }),
534
541
 
535
542
  /***/ "2310":
@@ -10354,13 +10361,6 @@ module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAADsCAMAAAAh
10354
10361
 
10355
10362
  /***/ }),
10356
10363
 
10357
- /***/ "9afc":
10358
- /***/ (function(module, exports, __webpack_require__) {
10359
-
10360
- // extracted by mini-css-extract-plugin
10361
-
10362
- /***/ }),
10363
-
10364
10364
  /***/ "9bf2":
10365
10365
  /***/ (function(module, exports, __webpack_require__) {
10366
10366
 
@@ -15149,43 +15149,42 @@ var button_component = normalizeComponent(
15149
15149
  )
15150
15150
 
15151
15151
  /* harmony default export */ var components_button = (button_component.exports);
15152
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"75d8bda1-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/tabs/index.vue?vue&type=template&id=430e7741
15153
- var tabsvue_type_template_id_430e7741_render = function render() {
15152
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"75d8bda1-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/tabs/index.vue?vue&type=template&id=6cfdbc71
15153
+ var tabsvue_type_template_id_6cfdbc71_render = function render() {
15154
15154
  var _vm = this,
15155
15155
  _c = _vm._self._c;
15156
15156
  return _c('div', {
15157
15157
  staticClass: "vd-tabs",
15158
15158
  class: _vm.stickyClasses
15159
15159
  }, [_c('div', {
15160
- ref: "tabsWrap",
15160
+ ref: "wrap",
15161
15161
  staticClass: "vd-tabs__wrap",
15162
15162
  class: _vm.menuClasses
15163
15163
  }, [_c('div', {
15164
- ref: "tabsContainer",
15164
+ ref: "nav",
15165
15165
  staticClass: "vd-tabs__nav",
15166
15166
  class: [_vm.barType, _vm.scrollspy]
15167
- }, _vm._l(_vm.navList, function (item, index) {
15167
+ }, _vm._l(_vm.tabs, function (tab, index) {
15168
15168
  return _c('div', {
15169
- key: index,
15170
- class: [_vm.tabClasses(item), _vm.lineClasses],
15169
+ key: tab.name !== undefined ? tab.name : index,
15170
+ ref: "tabItems",
15171
+ refInFor: true,
15172
+ class: [_vm.tabClasses(tab, index), _vm.lineClasses],
15171
15173
  on: {
15172
15174
  "click": function ($event) {
15173
- return _vm.handleChange(index);
15175
+ return _vm.onClick(tab, index);
15174
15176
  }
15175
15177
  }
15176
15178
  }, [_c('span', {
15177
- staticClass: "vd-tabs-text-cell",
15179
+ ref: "title",
15180
+ refInFor: true,
15181
+ staticClass: "vd-tab__text",
15178
15182
  class: _vm.ellipsisClasses
15179
- }, [_vm._v(" " + _vm._s(item.title) + " "), item.arrow ? _c('vd-icon', {
15180
- staticClass: "vd-tabs-arrow",
15181
- attrs: {
15182
- "name": "icon_btn_moredown"
15183
- }
15184
- }) : _vm._e()], 1)]);
15183
+ }, [_vm._v(" " + _vm._s(tab.title) + " ")])]);
15185
15184
  }), 0), _vm.menu ? _c('div', {
15186
- staticClass: "vd-tabs-menu--right"
15185
+ staticClass: "vd-tabs__menu--right"
15187
15186
  }, [_c('vd-icon', {
15188
- staticClass: "vd-tabs-menu-btn",
15187
+ staticClass: "vd-tabs__menu--btn",
15189
15188
  attrs: {
15190
15189
  "name": _vm.menuIconComputed
15191
15190
  },
@@ -15193,12 +15192,19 @@ var tabsvue_type_template_id_430e7741_render = function render() {
15193
15192
  "click": _vm.emitMenuClick
15194
15193
  }
15195
15194
  })], 1) : _vm._e()]), _c('div', {
15196
- staticClass: "vd-tabs__content"
15197
- }, [_vm._t("default")], 2)]);
15195
+ ref: "content",
15196
+ staticClass: "vd-tabs__content",
15197
+ class: {
15198
+ 'vd-tabs__content--animated': _vm.animated
15199
+ }
15200
+ }, [_vm.animated ? _c('div', {
15201
+ class: _vm.trackClasses,
15202
+ style: _vm.trackStyle
15203
+ }, [_vm._t("default")], 2) : _vm._t("default")], 2)]);
15198
15204
  };
15199
- var tabsvue_type_template_id_430e7741_staticRenderFns = [];
15205
+ var tabsvue_type_template_id_6cfdbc71_staticRenderFns = [];
15200
15206
 
15201
- // CONCATENATED MODULE: ./packages/components/tabs/index.vue?vue&type=template&id=430e7741
15207
+ // CONCATENATED MODULE: ./packages/components/tabs/index.vue?vue&type=template&id=6cfdbc71
15202
15208
 
15203
15209
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
15204
15210
  var es_array_push = __webpack_require__("14d9");
@@ -15218,7 +15224,6 @@ const prefixCls = "vd-tabs";
15218
15224
  type: String,
15219
15225
  default: "primary"
15220
15226
  },
15221
- // 将 menu 作为一个字段,同时控制显示和图标名称
15222
15227
  menu: {
15223
15228
  type: [Boolean, String],
15224
15229
  default: false
@@ -15231,30 +15236,44 @@ const prefixCls = "vd-tabs";
15231
15236
  backgroundColor: Boolean,
15232
15237
  divider: Boolean,
15233
15238
  sticky: Boolean,
15234
- lazyRender: Boolean
15239
+ lazyRender: Boolean,
15240
+ animated: Boolean
15235
15241
  },
15236
15242
  data() {
15237
15243
  return {
15238
- currentValue: this.value,
15239
- // 当前选中的标签名
15240
- navList: [],
15241
- // 标签导航列表
15242
- tabs: [] // 已注册的标签
15244
+ tabs: [],
15245
+ currentName: this.value !== undefined ? this.value : 0 // 默认为 0
15243
15246
  };
15244
15247
  },
15245
15248
  watch: {
15246
15249
  // 监听 value 变化,更新 currentValue
15247
15250
  value(val) {
15248
- this.currentValue = val;
15251
+ this.currentName = val;
15252
+ this.setCurrentName(val);
15249
15253
  }
15250
15254
  },
15251
15255
  computed: {
15256
+ trackClasses() {
15257
+ return {
15258
+ 'vd-tabs__track': true
15259
+ };
15260
+ },
15261
+ trackStyle() {
15262
+ const activeIndex = this.tabs.findIndex((tab, index) => {
15263
+ return this.isTabActive(tab, index);
15264
+ });
15265
+ const translateX = -activeIndex * 100;
15266
+ return {
15267
+ transform: `translateX(${translateX}%)`,
15268
+ transitionDuration: '0.3s'
15269
+ };
15270
+ },
15252
15271
  // 计算菜单按钮的图标,根据 menu 属性的类型决定图标
15253
15272
  menuIconComputed() {
15254
- if (typeof this.menu === 'string') {
15273
+ if (typeof this.menu === "string") {
15255
15274
  return this.menu;
15256
15275
  } else {
15257
- return 'icon_tab_morelist'; // 默认的菜单图标名称
15276
+ return "icon_tab_morelist"; // 默认的菜单图标名称
15258
15277
  }
15259
15278
  },
15260
15279
  // 计算滚动监视的类名
@@ -15264,13 +15283,13 @@ const prefixCls = "vd-tabs";
15264
15283
  // 计算标签文字是否需要省略号的类名
15265
15284
  ellipsisClasses() {
15266
15285
  return {
15267
- [`${prefixCls}-text--ellipsis`]: this.ellipsis
15286
+ [`vd-tab__text--ellipsis`]: this.ellipsis
15268
15287
  };
15269
15288
  },
15270
15289
  // 计算标签包裹器的类名,根据 menu、backgroundColor 和 divider 属性来确定
15271
15290
  menuClasses() {
15272
15291
  return {
15273
- [`${prefixCls}-menu`]: this.menu,
15292
+ [`${prefixCls}__menu`]: this.menu,
15274
15293
  [`${prefixCls}__wrap--bg`]: this.backgroundColor,
15275
15294
  "vd-hairline--bottom": this.divider
15276
15295
  };
@@ -15278,13 +15297,13 @@ const prefixCls = "vd-tabs";
15278
15297
  // 计算标签下方线条的类名
15279
15298
  lineClasses() {
15280
15299
  return {
15281
- [`${prefixCls}__line`]: !this.actBorder
15300
+ [`vd-tab__none--line`]: !this.actBorder
15282
15301
  };
15283
15302
  },
15284
15303
  // 根据 tabsType 属性计算标签类型的类名
15285
15304
  barType() {
15286
15305
  return {
15287
- [`${prefixCls}-${this.tabsType}-bar`]: this.tabsType
15306
+ [`${prefixCls}__nav--${this.tabsType}`]: this.tabsType
15288
15307
  };
15289
15308
  },
15290
15309
  stickyClasses() {
@@ -15296,86 +15315,126 @@ const prefixCls = "vd-tabs";
15296
15315
  methods: {
15297
15316
  // 当菜单按钮被点击时触发事件
15298
15317
  emitMenuClick() {
15299
- this.$emit('menu-click');
15318
+ this.$emit("menu-click");
15300
15319
  },
15301
15320
  // 计算每个标签项的类名
15302
- tabClasses(item) {
15321
+ tabClasses(tab, index) {
15322
+ const isActive = this.isTabActive(tab, index);
15303
15323
  return {
15304
- [`${prefixCls}-${this.tabsType}`]: true,
15305
- [`${prefixCls}-${this.tabsType}-active`]: item.name === this.currentValue
15324
+ 'vd-tab': true,
15325
+ 'vd-tab--active': isActive
15306
15326
  };
15307
15327
  },
15308
- // 注册新的标签到 tabs 数组中
15309
- registerTab(tab) {
15310
- if (!this.tabs.includes(tab)) {
15311
- this.tabs.push(tab);
15312
- this.updateNav();
15328
+ setCurrentName(name) {
15329
+ // 如果没有指定 name 属性,则使用索引值,确保索引值为数字类型
15330
+ const nameIsNumber = typeof name === 'number' || /^\d+$/.test(name);
15331
+ const parsedName = nameIsNumber ? Number(name) : name;
15332
+ const matchedTab = this.tabs.find((tab, index) => {
15333
+ if (tab.name !== undefined) {
15334
+ return tab.name === parsedName;
15335
+ } else {
15336
+ return index === parsedName;
15337
+ }
15338
+ });
15339
+ if (matchedTab) {
15340
+ this.currentName = matchedTab.name !== undefined ? matchedTab.name : this.tabs.indexOf(matchedTab);
15341
+ } else if (this.tabs.length > 0) {
15342
+ const firstTab = this.tabs[0];
15343
+ this.currentName = firstTab.name !== undefined ? firstTab.name : 0;
15344
+ } else {
15345
+ this.currentName = null;
15313
15346
  }
15347
+ this.$emit('input', this.currentName);
15314
15348
  },
15315
- // tabs 数组中注销一个标签
15316
- unregisterTab(tab) {
15349
+ isTabActive(tab, index) {
15350
+ if (tab.name !== undefined) {
15351
+ return tab.name === this.currentName;
15352
+ } else {
15353
+ return index === Number(this.currentName);
15354
+ }
15355
+ },
15356
+ addTab(tab) {
15357
+ this.tabs.push(tab);
15358
+ if (this.currentName === undefined) {
15359
+ this.setCurrentName(tab.name !== undefined ? tab.name : 0);
15360
+ }
15361
+ },
15362
+ removeTab(tab) {
15317
15363
  const index = this.tabs.indexOf(tab);
15318
15364
  if (index !== -1) {
15319
15365
  this.tabs.splice(index, 1);
15320
- this.updateNav();
15321
- }
15322
- },
15323
- // 根据已注册的标签更新导航列表
15324
- updateNav() {
15325
- this.navList = this.tabs.map((tab, index) => ({
15326
- title: tab.title,
15327
- name: tab.name != null ? tab.name : index,
15328
- arrow: tab.arrow
15329
- }));
15330
- // 如果当前没有选中的标签且导航列表不为空,则将第一个标签设为当前值
15331
- if (!this.currentValue && this.navList.length) {
15332
- this.currentValue = this.navList[0].name;
15333
- this.$emit("input", this.currentValue);
15334
- }
15335
- },
15336
- handleChange(index) {
15337
- const nav = this.navList[index];
15338
- const name = nav.name;
15339
- if (this.currentValue !== name) {
15340
- this.currentValue = name;
15341
- this.$emit("input", name); // 触发 input 事件,更新父组件中的 v-model 绑定值
15342
- this.$emit("change", {
15343
- index,
15344
- title: nav.title,
15345
- name
15346
- }); // 触发 change 事件,传递标签的详细信息
15347
- this.adjustTabPosition(index); // 调整选中标签的位置
15348
- }
15349
- this.$emit("click", {
15350
- index,
15351
- title: nav.title,
15352
- name
15353
- }); // 触发 click 事件,传递标签的详细信息
15354
- },
15355
- adjustTabPosition(index) {
15356
- const container = this.$refs.tabsContainer;
15357
- const selectedTab = container.children[index];
15358
- if (selectedTab) {
15359
- const containerWidth = container.offsetWidth;
15360
- const tabWidth = selectedTab.offsetWidth;
15361
- const tabOffsetLeft = selectedTab.offsetLeft;
15362
- const scrollLeft = tabOffsetLeft - (containerWidth - tabWidth) / 2;
15363
- container.scrollTo({
15366
+ }
15367
+ },
15368
+ onClick(tab, index) {
15369
+ if (tab.disabled) {
15370
+ this.$emit('disabled', tab.name !== undefined ? tab.name : index, index);
15371
+ } else {
15372
+ this.currentName = tab.name !== undefined ? tab.name : index;
15373
+ // 如果 currentName 是索引值,确保为数字类型
15374
+ if (tab.name === undefined) {
15375
+ this.currentName = Number(this.currentName);
15376
+ }
15377
+ this.$emit('input', this.currentName);
15378
+ this.$emit('change', this.currentName, index);
15379
+ // 切换标签后,滚动到当前标签
15380
+ this.$nextTick(() => {
15381
+ this.scrollToActiveTab();
15382
+ });
15383
+ }
15384
+ },
15385
+ scrollToActiveTab() {
15386
+ const scrollWrapper = this.$refs.nav; // 修改这里
15387
+ const tabItems = this.$refs.tabItems;
15388
+ if (!scrollWrapper || !tabItems || tabItems.length === 0) {
15389
+ return;
15390
+ }
15391
+ const activeIndex = this.tabs.findIndex((tab, index) => {
15392
+ return this.isTabActive(tab, index);
15393
+ });
15394
+ const activeTab = tabItems[activeIndex];
15395
+ if (activeTab) {
15396
+ const tabOffsetLeft = activeTab.offsetLeft;
15397
+ const tabWidth = activeTab.offsetWidth;
15398
+ const wrapperWidth = scrollWrapper.offsetWidth;
15399
+ const scrollLeft = tabOffsetLeft - (wrapperWidth - tabWidth) / 2;
15400
+ scrollWrapper.scrollTo({
15364
15401
  left: scrollLeft,
15365
- behavior: "smooth"
15402
+ behavior: 'smooth'
15366
15403
  });
15367
15404
  }
15405
+ },
15406
+ renderTitle(titleEl, tab) {
15407
+ this.$nextTick(() => {
15408
+ const index = this.tabs.indexOf(tab);
15409
+ if (index !== -1 && this.$refs.title && this.$refs.title[index]) {
15410
+ const navTitleEl = this.$refs.title[index];
15411
+ // 清空导航标题元素的内容
15412
+ navTitleEl.innerHTML = '';
15413
+ // 将子组件的 title 插槽内容移动到导航标题元素中
15414
+ while (titleEl.firstChild) {
15415
+ navTitleEl.appendChild(titleEl.firstChild);
15416
+ }
15417
+ }
15418
+ });
15368
15419
  }
15369
15420
  },
15370
15421
  mounted() {
15371
- // 组件挂载后更新导航列表
15372
- // this.updateNav();
15422
+ if (this.currentName !== undefined) {
15423
+ this.setCurrentName(this.currentName);
15424
+ } else if (this.tabs.length > 0) {
15425
+ const firstTab = this.tabs[0];
15426
+ this.currentName = firstTab.name !== undefined ? firstTab.name : 0;
15427
+ }
15428
+ // 初始加载时,滚动到当前激活的标签
15429
+ this.$nextTick(() => {
15430
+ this.scrollToActiveTab();
15431
+ });
15373
15432
  }
15374
15433
  });
15375
15434
  // CONCATENATED MODULE: ./packages/components/tabs/index.vue?vue&type=script&lang=js
15376
15435
  /* harmony default export */ var components_tabsvue_type_script_lang_js = (tabsvue_type_script_lang_js);
15377
- // EXTERNAL MODULE: ./packages/components/tabs/index.vue?vue&type=style&index=0&id=430e7741&prod&lang=less
15378
- var tabsvue_type_style_index_0_id_430e7741_prod_lang_less = __webpack_require__("1925");
15436
+ // EXTERNAL MODULE: ./packages/components/tabs/index.vue?vue&type=style&index=0&id=6cfdbc71&prod&lang=less
15437
+ var tabsvue_type_style_index_0_id_6cfdbc71_prod_lang_less = __webpack_require__("230a");
15379
15438
 
15380
15439
  // CONCATENATED MODULE: ./packages/components/tabs/index.vue
15381
15440
 
@@ -15388,8 +15447,8 @@ var tabsvue_type_style_index_0_id_430e7741_prod_lang_less = __webpack_require__(
15388
15447
 
15389
15448
  var tabs_component = normalizeComponent(
15390
15449
  components_tabsvue_type_script_lang_js,
15391
- tabsvue_type_template_id_430e7741_render,
15392
- tabsvue_type_template_id_430e7741_staticRenderFns,
15450
+ tabsvue_type_template_id_6cfdbc71_render,
15451
+ tabsvue_type_template_id_6cfdbc71_staticRenderFns,
15393
15452
  false,
15394
15453
  null,
15395
15454
  null,
@@ -15398,73 +15457,104 @@ var tabs_component = normalizeComponent(
15398
15457
  )
15399
15458
 
15400
15459
  /* harmony default export */ var tabs = (tabs_component.exports);
15401
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"75d8bda1-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/tab/index.vue?vue&type=template&id=2c2d2daf
15402
- var tabvue_type_template_id_2c2d2daf_render = function render() {
15460
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"75d8bda1-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/tab/index.vue?vue&type=template&id=6808f4f4
15461
+ var tabvue_type_template_id_6808f4f4_render = function render() {
15403
15462
  var _vm = this,
15404
15463
  _c = _vm._self._c;
15405
15464
  return _c('div', {
15406
- class: _vm.tabClasses
15407
- }, [_vm.shouldRender ? _vm._t("default") : _vm._e()], 2);
15465
+ directives: [{
15466
+ name: "show",
15467
+ rawName: "v-show",
15468
+ value: _vm.shouldShow,
15469
+ expression: "shouldShow"
15470
+ }],
15471
+ class: _vm.paneClasses
15472
+ }, [_vm.shouldRender ? _vm._t("default") : _vm._e(), _vm.$slots.title ? _c('div', {
15473
+ ref: "title"
15474
+ }, [_vm._t("title")], 2) : _vm._e()], 2);
15408
15475
  };
15409
- var tabvue_type_template_id_2c2d2daf_staticRenderFns = [];
15476
+ var tabvue_type_template_id_6808f4f4_staticRenderFns = [];
15410
15477
 
15411
- // CONCATENATED MODULE: ./packages/components/tab/index.vue?vue&type=template&id=2c2d2daf
15478
+ // CONCATENATED MODULE: ./packages/components/tab/index.vue?vue&type=template&id=6808f4f4
15412
15479
 
15413
15480
  // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/tab/index.vue?vue&type=script&lang=js
15414
15481
  /* harmony default export */ var tabvue_type_script_lang_js = ({
15415
15482
  name: 'vd-tab',
15416
15483
  props: {
15417
15484
  name: [String, Number],
15418
- title: {
15419
- type: String
15420
- },
15421
- arrow: {
15422
- type: Boolean,
15423
- default: false
15424
- }
15485
+ title: String
15425
15486
  },
15426
15487
  data() {
15427
15488
  return {
15428
- isRendered: false
15489
+ parent: null,
15490
+ inited: false
15429
15491
  };
15430
15492
  },
15431
- watch: {
15432
- isActive(newVal) {
15433
- if (newVal && !this.isRendered) {
15434
- this.isRendered = true;
15435
- }
15436
- }
15437
- },
15438
15493
  computed: {
15439
- isActive() {
15440
- return this.computedName === this.$parent.currentValue;
15441
- },
15442
- tabClasses() {
15494
+ paneClasses() {
15443
15495
  return {
15444
- 'vd-tab': true,
15445
- 'vd-tab-active': this.isActive
15496
+ 'vd-tab__pane': true
15446
15497
  };
15447
15498
  },
15448
- computedName() {
15449
- return this.name != null ? this.name : this.$parent.tabs.indexOf(this);
15450
- },
15451
- shouldRender() {
15452
- if (this.$parent.lazyRender) {
15453
- return this.isRendered || this.isActive;
15499
+ isActive() {
15500
+ if (!this.parent) return false;
15501
+ if (this.name !== undefined) {
15502
+ return this.name === this.parent.currentName;
15454
15503
  } else {
15455
- return true;
15504
+ const index = this.parent.tabs.indexOf(this);
15505
+ return index === Number(this.parent.currentName);
15456
15506
  }
15457
15507
  },
15458
- computedTitle() {
15459
- // Since the title slot is now handled by vd-tabs, we return the title prop
15460
- return this.title;
15508
+ shouldShow() {
15509
+ // animated true 时,所有标签页都需要渲染(用于动画效果)
15510
+ // 当 animated 为 false 时,只渲染当前激活的标签页
15511
+ return this.isActive || this.parent && this.parent.animated;
15512
+ },
15513
+ shouldRender() {
15514
+ return this.inited || !(this.parent && this.parent.lazyRender);
15515
+ }
15516
+ },
15517
+ watch: {
15518
+ isActive(val) {
15519
+ if (val) {
15520
+ this.inited = true;
15521
+ }
15461
15522
  }
15462
15523
  },
15463
15524
  created() {
15464
- this.$parent.registerTab(this);
15525
+ this.parent = this.findParent('vd-tabs');
15526
+ if (this.parent) {
15527
+ this.parent.addTab(this);
15528
+ } else {
15529
+ console.error('vd-tab must be used within vd-tabs.');
15530
+ }
15531
+ },
15532
+ mounted() {
15533
+ if (this.isActive) {
15534
+ this.inited = true;
15535
+ }
15536
+ // 如果存在 title 插槽,调用父组件的 renderTitle 方法
15537
+ if (this.$slots.title && this.$refs.title) {
15538
+ this.parent.renderTitle(this.$refs.title, this);
15539
+ this.$refs.title.parentNode.removeChild(this.$refs.title);
15540
+ }
15465
15541
  },
15466
15542
  beforeDestroy() {
15467
- this.$parent.unregisterTab(this);
15543
+ if (this.parent) {
15544
+ this.parent.removeTab(this);
15545
+ }
15546
+ },
15547
+ methods: {
15548
+ findParent(name) {
15549
+ let parent = this.$parent;
15550
+ while (parent) {
15551
+ if (parent.$options && parent.$options.name === name) {
15552
+ return parent;
15553
+ }
15554
+ parent = parent.$parent;
15555
+ }
15556
+ return null;
15557
+ }
15468
15558
  }
15469
15559
  });
15470
15560
  // CONCATENATED MODULE: ./packages/components/tab/index.vue?vue&type=script&lang=js
@@ -15479,8 +15569,8 @@ var tabvue_type_template_id_2c2d2daf_staticRenderFns = [];
15479
15569
 
15480
15570
  var tab_component = normalizeComponent(
15481
15571
  components_tabvue_type_script_lang_js,
15482
- tabvue_type_template_id_2c2d2daf_render,
15483
- tabvue_type_template_id_2c2d2daf_staticRenderFns,
15572
+ tabvue_type_template_id_6808f4f4_render,
15573
+ tabvue_type_template_id_6808f4f4_staticRenderFns,
15484
15574
  false,
15485
15575
  null,
15486
15576
  null,
@@ -20822,6 +20912,8 @@ var toast_component = normalizeComponent(
20822
20912
 
20823
20913
 
20824
20914
 
20915
+
20916
+ let queueResult = [];
20825
20917
  function getType(value) {
20826
20918
  if (value !== value) return 'NaN';
20827
20919
  return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
@@ -20876,12 +20968,22 @@ class toast_VdToast extends vue_runtime_esm["a" /* default */].extend(components
20876
20968
  this.isShow = false;
20877
20969
  if (inBrowser && this.vm.$el) {
20878
20970
  setTimeout(() => {
20879
- this.vm.$el.parentNode.removeChild(this.vm.$el);
20971
+ this.vm.$el.parentNode && this.vm.$el.parentNode.removeChild(this.vm.$el);
20880
20972
  }, 500);
20881
20973
  }
20882
20974
  }
20883
20975
  }
20884
- const Toast = options => new toast_VdToast(options);
20976
+ const Toast = options => {
20977
+ const NewOption = new toast_VdToast(options);
20978
+ queueResult.push(NewOption);
20979
+ return NewOption;
20980
+ };
20981
+ Toast.clear = () => {
20982
+ queueResult.forEach(toast => {
20983
+ toast.clear();
20984
+ });
20985
+ queueResult = [];
20986
+ };
20885
20987
  /* harmony default export */ var packages_components_toast = (Toast);
20886
20988
  // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"75d8bda1-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/footer/index.vue?vue&type=template&id=2c9567c1
20887
20989
  var footervue_type_template_id_2c9567c1_render = function render() {