@phoenix-cg/v-tabs 0.1.33 → 0.1.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phoenix-cg/v-tabs",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -2,11 +2,13 @@
2
2
  <div class="v-tabs-wrap">
3
3
  <div ref="tabsEl" class="v-tabs" :class="[`__${direction}`]">
4
4
  <div class="v-tabs_inner">
5
- <div
5
+ <component
6
+ :is="tabComponent"
6
7
  v-for="tab in list"
7
8
  :key="tab[trackBy]"
8
9
  ref="tabs"
9
10
  class="v-tabs_tab"
11
+ v-bind="tabProps(tab)"
10
12
  :data-id="tab[trackBy]"
11
13
  :class="{
12
14
  __active: value && value[trackBy] === tab[trackBy],
@@ -24,10 +26,9 @@
24
26
  {{ tab[label] || "" }}
25
27
  </template>
26
28
  </slot>
27
- </div>
29
+ </component>
28
30
  </div>
29
31
  <div v-if="withSlider" :style="sliderStyle" class="v-tabs_slider" />
30
-
31
32
  </div>
32
33
  <component :is="mobileHintComponent" class="v-tabs-hint" :class="{ __visible: isHintVisible }" />
33
34
  </div>
@@ -81,6 +82,14 @@ export default {
81
82
  mobileHintHideDelay: {
82
83
  type: Number,
83
84
  default: 2000
85
+ },
86
+ tabComponent: {
87
+ type: String,
88
+ default: 'div'
89
+ },
90
+ tabProps: {
91
+ type: Function,
92
+ default: () => ({})
84
93
  }
85
94
  },
86
95
  data () {
@@ -91,6 +100,11 @@ export default {
91
100
  hintObserver: null
92
101
  }
93
102
  },
103
+ computed: {
104
+ hintShowCondition () {
105
+ return this.mobileHintComponent
106
+ }
107
+ },
94
108
  watch: {
95
109
  value () {
96
110
  this.withSlider && this.calcSlider()
@@ -102,11 +116,6 @@ export default {
102
116
  this.createHintObserver()
103
117
  }
104
118
  },
105
- computed: {
106
- hintShowCondition () {
107
- return this.mobileHintComponent
108
- }
109
- },
110
119
  mounted () {
111
120
  if (this.selectFirst && this.list.length && !this.value) {
112
121
  this.handleTabSelect(this.list[0])
@@ -139,7 +148,7 @@ export default {
139
148
  }, {
140
149
  threshold: 1.0
141
150
  })
142
- this.hintObserver.observe(this.$el)
151
+ // this.hintObserver.observe(this.$el)
143
152
  }
144
153
  },
145
154
  queueShowHint () {
@@ -159,7 +168,8 @@ export default {
159
168
  this.calcSlider()
160
169
  })
161
170
  this.$refs.tabs.forEach(tabEl => {
162
- this.resizeObserver.observe(tabEl)
171
+ const el = tabEl.$el || tabEl
172
+ this.resizeObserver.observe(el)
163
173
  })
164
174
  }
165
175
  },
@@ -232,5 +242,5 @@ export default {
232
242
  }
233
243
  .v-tabs-hint.__visible {
234
244
  opacity: 1;
235
- }
245
+ }
236
246
  </style>