@varlet/ui 2.11.1 → 2.11.2

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.
@@ -1,6 +1,6 @@
1
1
  import VarSwipeItem from '../swipe-item/index.mjs';
2
- import { defineComponent, computed } from 'vue';
3
- import { useLists, useTabsItems } from './provide.mjs';
2
+ import { defineComponent, ref, computed } from 'vue';
3
+ import { useTabsItems, useLists } from './provide.mjs';
4
4
  import { props } from './props.mjs';
5
5
  import { createNamespace } from '../utils/components.mjs';
6
6
  var {
@@ -33,20 +33,25 @@ var __sfc__ = defineComponent({
33
33
  props,
34
34
 
35
35
  setup(props) {
36
+ var current = ref(false);
37
+ var name = computed(() => props.name);
36
38
  var {
37
39
  index,
38
- tabsItems,
39
40
  bindTabsItems
40
41
  } = useTabsItems();
41
42
  var {
42
43
  bindLists
43
44
  } = useLists();
44
- var name = computed(() => props.name);
45
- var current = computed(() => index.value === Number(tabsItems.active.value));
45
+
46
+ var setCurrent = value => {
47
+ current.value = value;
48
+ };
49
+
46
50
  var tabItemProvider = {
47
51
  index,
48
52
  name,
49
- current
53
+ current: computed(() => current.value),
54
+ setCurrent
50
55
  };
51
56
  bindTabsItems(tabItemProvider);
52
57
  bindLists(tabItemProvider);
@@ -3,10 +3,10 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
3
3
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
4
 
5
5
  import VarSwipe from '../swipe/index.mjs';
6
- import { defineComponent, watch, ref, computed } from 'vue';
6
+ import { defineComponent, watch, ref } from 'vue';
7
+ import { useTabItem } from './provide.mjs';
7
8
  import { call, createNamespace } from '../utils/components.mjs';
8
9
  import { props } from './props.mjs';
9
- import { useTabItem } from './provide.mjs';
10
10
  import { doubleRaf } from '../utils/elements.mjs';
11
11
  var {
12
12
  n
@@ -42,7 +42,6 @@ var __sfc__ = defineComponent({
42
42
 
43
43
  setup(props) {
44
44
  var swipe = ref(null);
45
- var active = computed(() => props.active);
46
45
  var {
47
46
  tabItemList,
48
47
  bindTabItem,
@@ -80,16 +79,23 @@ var __sfc__ = defineComponent({
80
79
  return;
81
80
  }
82
81
 
82
+ tabItemList.forEach(_ref3 => {
83
+ var {
84
+ setCurrent
85
+ } = _ref3;
86
+ return setCurrent(false);
87
+ });
88
+ newActiveTabItemProvider.setCurrent(true);
83
89
  (_swipe$value = swipe.value) == null ? void 0 : _swipe$value.to(newActiveTabItemProvider.index.value);
84
90
  };
85
91
 
86
92
  var handleSwipeChange = currentIndex => {
87
93
  var _tabItem$name$value;
88
94
 
89
- var tabItem = tabItemList.find(_ref3 => {
95
+ var tabItem = tabItemList.find(_ref4 => {
90
96
  var {
91
97
  index
92
- } = _ref3;
98
+ } = _ref4;
93
99
  return index.value === currentIndex;
94
100
  });
95
101
  var active = (_tabItem$name$value = tabItem.name.value) != null ? _tabItem$name$value : tabItem.index.value;
@@ -101,10 +107,7 @@ var __sfc__ = defineComponent({
101
107
  return swipe.value;
102
108
  };
103
109
 
104
- var tabsItemsProvider = {
105
- active
106
- };
107
- bindTabItem(tabsItemsProvider);
110
+ bindTabItem({});
108
111
  watch(() => props.active, handleActiveChange);
109
112
  watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
110
113
  yield doubleRaf();