mali-applet-ui 0.1.19 → 0.1.20

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.
@@ -12,6 +12,7 @@ export default {
12
12
  },
13
13
  props: {
14
14
  name: [String, Number],
15
+ title: String,
15
16
  className: String
16
17
  },
17
18
  inject: {
@@ -20,6 +21,27 @@ export default {
20
21
  default: null
21
22
  }
22
23
  },
24
+ data () {
25
+ return {
26
+ mId: XEUtils.uniqueId('mlTabPane')
27
+ }
28
+ },
29
+ mounted () {
30
+ this.$nextTick(() => {
31
+ if (this.tabs) {
32
+ this.tabs.tabList.push({
33
+ mId: this.mId,
34
+ name: this.name,
35
+ title: this.title
36
+ })
37
+ }
38
+ })
39
+ },
40
+ beforeDestroy () {
41
+ if (this.tabs) {
42
+ XEUtils.remove(this.tabs.itemList, item => item.mId === this.mId)
43
+ }
44
+ },
23
45
  computed: {
24
46
  selectTab () {
25
47
  return this.tabs ? this.tabs.value : null
@@ -3,8 +3,8 @@
3
3
  <view class="ml-tabs-header">
4
4
  <scroll-view scroll-x>
5
5
  <view class="ml-tabs-navs" :class="[itemAlign ? `is-${itemAlign}` : '']">
6
- <view class="ml-tabs-nav-item" v-for="(item, index) in options" :key="index" :class="{'is-active': value === item.value}" :style="itemStyles" @tap="changeEvent(item)">
7
- <view class="ml-tabs-nav-title">{{ item.label }}</view>
6
+ <view class="ml-tabs-nav-item" v-for="(item, index) in tabList" :key="index" :class="{'is-active': value === item.name}" :style="itemStyles" @tap="changeEvent(item)">
7
+ <view class="ml-tabs-nav-title">{{ item.title }}</view>
8
8
  </view>
9
9
  </view>
10
10
  </scroll-view>
@@ -22,7 +22,6 @@ export default {
22
22
  name: 'MlTabs',
23
23
  props: {
24
24
  value: [String, Number],
25
- options: Array,
26
25
  className: String,
27
26
  itemAlign: String,
28
27
  itemWidth: String
@@ -33,7 +32,9 @@ export default {
33
32
  }
34
33
  },
35
34
  data () {
36
- return {}
35
+ return {
36
+ tabList: []
37
+ }
37
38
  },
38
39
  computed: {
39
40
  itemStyles () {
@@ -42,7 +43,7 @@ export default {
42
43
  },
43
44
  methods: {
44
45
  changeEvent (item) {
45
- const value = item.value
46
+ const value = item.name
46
47
  this.$emit('input', value)
47
48
  this.$emit('change', { value })
48
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",