aaa-ui-test 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of aaa-ui-test might be problematic. Click here for more details.

Files changed (104) hide show
  1. package/README.md +62 -0
  2. package/babel-plugin-on-demand-load/index.js +74 -0
  3. package/babel-plugin-on-demand-load/report.js +49 -0
  4. package/lib/index.css +2213 -0
  5. package/lib/index.js +10083 -0
  6. package/package.json +73 -0
  7. package/src/assets/css/common/_mixin.scss +130 -0
  8. package/src/assets/css/common/_var.scss +69 -0
  9. package/src/components/address/index.js +8 -0
  10. package/src/components/address/index.scss +72 -0
  11. package/src/components/address/src/address.vue +238 -0
  12. package/src/components/amount/index.js +6 -0
  13. package/src/components/amount/index.scss +88 -0
  14. package/src/components/amount/src/amount.vue +143 -0
  15. package/src/components/button/__tests__/__snapshots__/index.test.js.snap +7 -0
  16. package/src/components/button/__tests__/index.test.js +39 -0
  17. package/src/components/button/index.js +7 -0
  18. package/src/components/button/index.scss +83 -0
  19. package/src/components/button/src/button.vue +39 -0
  20. package/src/components/button-group/index.js +8 -0
  21. package/src/components/button-group/index.scss +37 -0
  22. package/src/components/button-group/src/button-group.vue +21 -0
  23. package/src/components/checkbox/index.js +8 -0
  24. package/src/components/checkbox/index.scss +47 -0
  25. package/src/components/checkbox/src/checkbox-group.vue +53 -0
  26. package/src/components/checkbox/src/checkbox.vue +153 -0
  27. package/src/components/date-selecter/index.js +6 -0
  28. package/src/components/date-selecter/index.scss +190 -0
  29. package/src/components/date-selecter/src/dateselecter.vue +387 -0
  30. package/src/components/default/index.js +6 -0
  31. package/src/components/default/index.scss +25 -0
  32. package/src/components/default/src/default.vue +23 -0
  33. package/src/components/dialog/index.js +146 -0
  34. package/src/components/dialog/index.scss +250 -0
  35. package/src/components/dialog/src/dialog.vue +153 -0
  36. package/src/components/field/index.js +8 -0
  37. package/src/components/field/index.scss +93 -0
  38. package/src/components/field/src/field.vue +57 -0
  39. package/src/components/input/__tests__/__snapshots__/index.test.js.snap +10 -0
  40. package/src/components/input/__tests__/index.test.js +63 -0
  41. package/src/components/input/index.js +8 -0
  42. package/src/components/input/index.scss +91 -0
  43. package/src/components/input/src/input.vue +214 -0
  44. package/src/components/list/index.js +8 -0
  45. package/src/components/list/index.scss +21 -0
  46. package/src/components/list/src/list.vue +16 -0
  47. package/src/components/list-item/index.js +8 -0
  48. package/src/components/list-item/index.scss +126 -0
  49. package/src/components/list-item/src/list-item.vue +59 -0
  50. package/src/components/loading/__tests__/__snapshots__/index.test.js.snap +9 -0
  51. package/src/components/loading/__tests__/index.test.js +30 -0
  52. package/src/components/loading/index.js +128 -0
  53. package/src/components/loading/index.scss +33 -0
  54. package/src/components/loading/src/loading.vue +23 -0
  55. package/src/components/mask/index.js +9 -0
  56. package/src/components/mask/index.scss +16 -0
  57. package/src/components/mask/src/mask.vue +52 -0
  58. package/src/components/notice/index.js +6 -0
  59. package/src/components/notice/index.scss +81 -0
  60. package/src/components/notice/src/notice.vue +128 -0
  61. package/src/components/overlay/index.js +8 -0
  62. package/src/components/overlay/index.scss +119 -0
  63. package/src/components/overlay/src/overlay.vue +72 -0
  64. package/src/components/picker/index.js +7 -0
  65. package/src/components/picker/index.scss +49 -0
  66. package/src/components/picker/src/picker.vue +205 -0
  67. package/src/components/popup/index.js +8 -0
  68. package/src/components/popup/index.scss +79 -0
  69. package/src/components/popup/src/popup.vue +88 -0
  70. package/src/components/popup-header/index.js +8 -0
  71. package/src/components/popup-header/index.scss +45 -0
  72. package/src/components/popup-header/src/popup-header.vue +41 -0
  73. package/src/components/radio/index.js +8 -0
  74. package/src/components/radio/index.scss +19 -0
  75. package/src/components/radio/src/radio.vue +51 -0
  76. package/src/components/select/index.js +8 -0
  77. package/src/components/select/index.scss +51 -0
  78. package/src/components/select/src/select.vue +86 -0
  79. package/src/components/swiper/index.js +6 -0
  80. package/src/components/swiper/index.scss +49 -0
  81. package/src/components/swiper/src/swiper.vue +211 -0
  82. package/src/components/switch/__tests__/__snapshots__/index.test.js.snap +15 -0
  83. package/src/components/switch/__tests__/index.test.js +44 -0
  84. package/src/components/switch/index.js +8 -0
  85. package/src/components/switch/index.scss +85 -0
  86. package/src/components/switch/src/switch.vue +60 -0
  87. package/src/components/tabs/index.js +8 -0
  88. package/src/components/tabs/index.scss +73 -0
  89. package/src/components/tabs/src/tab-item.vue +40 -0
  90. package/src/components/tabs/src/tabs.vue +121 -0
  91. package/src/components/textarea/index.js +8 -0
  92. package/src/components/textarea/index.scss +41 -0
  93. package/src/components/textarea/src/textarea.vue +140 -0
  94. package/src/components/toast/__tests__/__snapshots__/index.test.js.snap +3 -0
  95. package/src/components/toast/__tests__/index.test.js +25 -0
  96. package/src/components/toast/index.js +53 -0
  97. package/src/components/toast/index.scss +102 -0
  98. package/src/components/toast/src/toast.vue +19 -0
  99. package/src/index.js +87 -0
  100. package/src/mixins/emitter.js +33 -0
  101. package/src/mixins/visible.js +23 -0
  102. package/src/utils/clickoutside.js +42 -0
  103. package/src/utils/fix-body.js +46 -0
  104. package/src/utils/utils.js +71 -0
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <jdd-field
3
+ :label="label"
4
+ :isFocus="hasValue"
5
+ :direction="direction"
6
+ :border="border"
7
+ @label-click="onClick"
8
+ >
9
+ <div class="jdd-field-control jdd-field-select">
10
+ <span
11
+ class="jdd-select-show"
12
+ :style="{color:getColor}"
13
+ :class="{'jdd-field-hasvalue':value}"
14
+ >{{textTrans}}</span>
15
+ <i class="jdd-select-icon"></i>
16
+ </div>
17
+ </jdd-field>
18
+ </template>
19
+ <script>
20
+ import jddField from "../../field";
21
+ export default {
22
+ name: "JddSelect",
23
+ props: {
24
+ direction: {
25
+ type: String,
26
+ default: "row"
27
+ },
28
+ title: {
29
+ type: String,
30
+ default: ""
31
+ },
32
+ value: {
33
+ type: String,
34
+ default: ""
35
+ },
36
+ disabled: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ placeholder: {
41
+ type: String,
42
+ default: ""
43
+ },
44
+ border: {
45
+ type: String,
46
+ default: ""
47
+ },
48
+ prompt:{
49
+ type: Boolean,
50
+ default: false
51
+ }
52
+ },
53
+ components: {
54
+ jddField
55
+ },
56
+ data() {
57
+ return {
58
+ isFocus: false,
59
+ placeholderText: this.placeholder,
60
+ label: this.title,
61
+ };
62
+ },
63
+ methods: {
64
+ onClick(){
65
+ this.$emit("get-select")
66
+ }
67
+ },
68
+ computed: {
69
+ textTrans() {
70
+ if(this.direction==="row"){
71
+ return this.value || this.placeholder;
72
+ }else{
73
+ return this.value
74
+ }
75
+ },
76
+ getColor() {
77
+ return this.value ? "#333":this.prompt ? "#4D7BFE" : "#CCC";
78
+ },
79
+ hasValue() {
80
+ return this.value !== "";
81
+ }
82
+ }
83
+ };
84
+ </script>
85
+
86
+
@@ -0,0 +1,6 @@
1
+ import Swiper from './src/swiper.vue';
2
+ import "./index.scss";
3
+ Swiper.install = function(Vue){
4
+ Vue.component(Swiper.name, Swiper);
5
+ }
6
+ export default Swiper;
@@ -0,0 +1,49 @@
1
+ .jdd-swiper {
2
+ min-height: 1px;
3
+ height: 100%;
4
+ .jdd-swiper-group {
5
+ position: relative;
6
+ height: 100%;
7
+ overflow: hidden;
8
+ white-space: nowrap;
9
+ .jdd-swiper-item {
10
+ float: left;
11
+ box-sizing: border-box;
12
+ overflow: hidden;
13
+ text-align: center;
14
+ a {
15
+ display: block;
16
+ width: 100%;
17
+ overflow: hidden;
18
+ text-decoration: none;
19
+ }
20
+ img {
21
+ display: block;
22
+ width: 100%;
23
+ }
24
+ }
25
+ }
26
+ }
27
+ .jdd-dots {
28
+ position: absolute;
29
+ right: 0;
30
+ left: 0;
31
+ bottom: 6px;
32
+ transform: translateZ(1px);
33
+ text-align: center;
34
+ font-size: 0;
35
+ .jdd-dot {
36
+ display: inline-block;
37
+ margin: 0 4px;
38
+ width: 6px;
39
+ height: 6px;
40
+ border-radius: 100%;
41
+ background:rgba(255,255,255,1);
42
+ opacity:0.3;
43
+ &.active {
44
+ border-radius: 100%;
45
+ opacity: 1;
46
+ background: #fff;
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,211 @@
1
+ <template>
2
+ <div class="jdd-swiper" ref="swiper">
3
+ <div class="jdd-swiper-group" ref="swiperGroup">
4
+ <slot></slot>
5
+ </div>
6
+ <div v-if="showDot" class="jdd-dots">
7
+ <span
8
+ class="jdd-dot"
9
+ :class="{active: currentPageIndex === index }"
10
+ v-for="(item, index) in dots"
11
+ ></span>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import { addClass } from "@/utils/utils";
18
+ import BScroll from "better-scroll";
19
+
20
+ const COMPONENT_NAME = "JddSwiper";
21
+
22
+ export default {
23
+ name: COMPONENT_NAME,
24
+ props: {
25
+ loop: {
26
+ type: Boolean,
27
+ default: true
28
+ },
29
+ autoPlay: {
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+ interval: {
34
+ type: Number,
35
+ default: 4000
36
+ },
37
+ showDot: {
38
+ type: Boolean,
39
+ default: true
40
+ },
41
+ click: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ threshold: {
46
+ type: Number,
47
+ default: 0.3
48
+ },
49
+ speed: {
50
+ type: Number,
51
+ default: 400
52
+ }
53
+ },
54
+ data() {
55
+ return {
56
+ dots: [],
57
+ currentPageIndex: 0
58
+ };
59
+ },
60
+ mounted() {
61
+ this.update();
62
+
63
+ window.addEventListener("resize", () => {
64
+ if (!this.slide || !this.slide.enabled) {
65
+ return;
66
+ }
67
+ clearTimeout(this.resizeTimer);
68
+ this.resizeTimer = setTimeout(() => {
69
+ if (this.slide.isInTransition) {
70
+ this._onScrollEnd();
71
+ } else {
72
+ if (this.autoPlay) {
73
+ this._play();
74
+ }
75
+ }
76
+ this.refresh();
77
+ }, 60);
78
+ });
79
+ },
80
+ activated() {
81
+ if (!this.slide) {
82
+ return;
83
+ }
84
+ this.slide.enable();
85
+ let pageIndex = this.slide.getCurrentPage().pageX;
86
+ this.slide.goToPage(pageIndex, 0, 0);
87
+ this.currentPageIndex = pageIndex;
88
+ if (this.autoPlay) {
89
+ this._play();
90
+ }
91
+ },
92
+ deactivated() {
93
+ this.slide.disable();
94
+ clearTimeout(this.timer);
95
+ },
96
+ beforeDestroy() {
97
+ this.slide.disable();
98
+ clearTimeout(this.timer);
99
+ },
100
+ methods: {
101
+ update() {
102
+ if (this.slide) {
103
+ this.slide.destroy();
104
+ }
105
+ this.$nextTick(() => {
106
+ this.init();
107
+ });
108
+ },
109
+ refresh() {
110
+ this._setSlideWidth(true);
111
+ this.slide.refresh();
112
+ },
113
+ prev() {
114
+ this.slide.prev();
115
+ },
116
+ next() {
117
+ this.slide.next();
118
+ },
119
+ init() {
120
+ clearTimeout(this.timer);
121
+ this.currentPageIndex = 0;
122
+ this._setSlideWidth();
123
+ if (this.showDot) {
124
+ this._initDots();
125
+ }
126
+ this._initSlide();
127
+
128
+ if (this.autoPlay) {
129
+ this._play();
130
+ }
131
+ },
132
+ _setSlideWidth(isResize) {
133
+ this.children = this.$refs.swiperGroup.children;
134
+
135
+ let width = 0;
136
+ let slideWidth = this.$refs.swiper.clientWidth;
137
+ for (let i = 0; i < this.children.length; i++) {
138
+ let child = this.children[i];
139
+ addClass(child, "jdd-swiper-item");
140
+
141
+ child.style.width = slideWidth + "px";
142
+ width += slideWidth;
143
+ }
144
+ if (this.loop && !isResize) {
145
+ width += 2 * slideWidth;
146
+ }
147
+ this.$refs.swiperGroup.style.width = width + "px";
148
+ },
149
+ _initSlide() {
150
+ console.log(this.threshold);
151
+ this.slide = new BScroll(this.$refs.swiper, {
152
+ scrollX: true,
153
+ scrollY: false,
154
+ momentum: false,
155
+ snap: {
156
+ loop: this.loop,
157
+ threshold: this.threshold,
158
+ speed: this.speed
159
+ },
160
+ bounce: false,
161
+ stopPropagation: true,
162
+ click: this.click
163
+ });
164
+
165
+ this.slide.on("scrollEnd", this._onScrollEnd);
166
+
167
+ this.slide.on("touchEnd", () => {
168
+ if (this.autoPlay) {
169
+ this._play();
170
+ }
171
+ });
172
+
173
+ this.slide.on("beforeScrollStart", () => {
174
+ if (this.autoPlay) {
175
+ clearTimeout(this.timer);
176
+ }
177
+ });
178
+ },
179
+ _onScrollEnd() {
180
+ let pageIndex = this.slide.getCurrentPage().pageX;
181
+ this.currentPageIndex = pageIndex;
182
+ if (this.autoPlay) {
183
+ this._play();
184
+ }
185
+ },
186
+ _initDots() {
187
+ this.dots = new Array(this.children.length);
188
+ },
189
+ _play() {
190
+ clearTimeout(this.timer);
191
+ this.timer = setTimeout(() => {
192
+ this.slide.next();
193
+ }, this.interval);
194
+ }
195
+ },
196
+ watch: {
197
+ loop() {
198
+ this.update();
199
+ },
200
+ autoPlay() {
201
+ this.update();
202
+ },
203
+ speed() {
204
+ this.update();
205
+ },
206
+ threshold() {
207
+ this.update();
208
+ }
209
+ }
210
+ };
211
+ </script>
@@ -0,0 +1,15 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Switch has a correct class column 1`] = `
4
+ <div class="jdd-field-row jdd-field jdd-field-common jdd-field-border-bottom">
5
+ <div class="jdd-field-label">是否继续</div>
6
+ <div class="jdd-field-control jdd-field-switch"><label for="" class="jdd-switch"><input type="checkbox" class="jdd-switch-input"> <span class="jdd-switch-show"></span></label></div>
7
+ </div>
8
+ `;
9
+
10
+ exports[`Switch renders the correct markup 1`] = `
11
+ <div class="jdd-field-row jdd-field-inline jdd-field-common jdd-field-border-bottom">
12
+ <div class="jdd-field-label">是否继续</div>
13
+ <div class="jdd-field-control jdd-field-switch"><label for="" class="jdd-switch"><input type="checkbox" class="jdd-switch-input"> <span class="jdd-switch-show"></span></label></div>
14
+ </div>
15
+ `;
@@ -0,0 +1,44 @@
1
+ // Import the mount() method from the test utils
2
+ // and the component you want to test
3
+ import { createWrapper, mount } from "@vue/test-utils";
4
+ import Switch from "..";
5
+ import { asyncExpect, flushPromises } from "@/../test/utils.js";
6
+
7
+ describe("Switch", () => {
8
+ let title = "是否继续";
9
+ const wrapper = mount(Switch, {
10
+ propsData: {
11
+ value: "",
12
+ title: title,
13
+ border:"bottom"
14
+ }
15
+ });
16
+
17
+ it("renders the correct markup", async () => {
18
+ expect(wrapper.html()).toMatchSnapshot();
19
+ });
20
+ const getTask = async function() {
21
+ wrapper.find(".jdd-switch").trigger("click");
22
+
23
+ await asyncExpect(() => {
24
+ expect(wrapper.vm.value).toBe(true);
25
+ }, 0);
26
+ wrapper.find(".jdd-switch").trigger("click");
27
+
28
+ await asyncExpect(() => {
29
+ expect(wrapper.vm.value).toBe(false);
30
+ }, 0);
31
+ };
32
+ it("has a correct class row", () => {
33
+ //expect(wrapper.classes()).toContain(['jdd-field-inline','jdd-field-common'])
34
+ expect(wrapper.classes("jdd-field-inline")).toBe(true);
35
+ expect(wrapper.classes("jdd-field-common")).toBe(true);
36
+ getTask();
37
+ });
38
+ it("has a correct class column", () => {
39
+ wrapper.setProps({ direction: "column" });
40
+ expect(wrapper.html()).toMatchSnapshot();
41
+ expect(wrapper.classes("jdd-field")).toBe(true);
42
+ getTask();
43
+ });
44
+ });
@@ -0,0 +1,8 @@
1
+ import Switch from './src/switch.vue';
2
+ import "./index.scss";
3
+
4
+ Switch.install = function(Vue){
5
+ Vue.component(Switch.name, Switch);
6
+ }
7
+
8
+ export default Switch;
@@ -0,0 +1,85 @@
1
+ $jdd-switch-width: 49px;
2
+ $jdd-switch-height: 29px;
3
+ $jdd-switch-color: #4d7bfe;
4
+ $jdd-switch-disable-color: #b9d1f8;
5
+ .jdd-field-switch {
6
+ text-align: right;
7
+ display: flex;
8
+ align-items: center;
9
+ .jdd-switch-disable {
10
+ input[type="checkbox"]:checked + .jdd-switch-show {
11
+ border-color: $jdd-switch-disable-color;
12
+ background-color: $jdd-switch-disable-color;
13
+ }
14
+ }
15
+ }
16
+ .jdd-switch {
17
+ position: relative;
18
+ font-size: 0;
19
+ display: inline-block;
20
+ width: 100%;
21
+ .jdd-switch-show {
22
+ width: $jdd-switch-width;
23
+ height: $jdd-switch-height;
24
+ //border: 1px solid rgba(0, 0, 0, 0.1);
25
+ display: inline-block;
26
+ position: relative;
27
+ border-radius: 16px;
28
+ box-sizing: border-box;
29
+ background: #e5e5e5;
30
+ }
31
+ input[type="checkbox"] {
32
+ position: absolute;
33
+ top: 0px;
34
+ left: 0px;
35
+ opacity: 0;
36
+ width: 100%;
37
+ height: 100%;
38
+ z-index: 3;
39
+ appearance: none;
40
+ border: 0px;
41
+ }
42
+
43
+ input[type="checkbox"]:checked + .jdd-switch-show {
44
+ border-color: $jdd-switch-color;
45
+ background-color: $jdd-switch-color;
46
+ }
47
+ input[type="checkbox"]:checked + .jdd-switch-show::after {
48
+ transform: translateX(23px);
49
+ }
50
+ input[type="checkbox"]:checked + .jdd-switch-show::before {
51
+ transform: scale(0);
52
+ }
53
+
54
+ .jdd-switch-show::before {
55
+ content: " ";
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ width: 100%;
60
+ height: 100%;
61
+ box-sizing: border-box;
62
+ z-index: 1;
63
+ transform: scale(1);
64
+ border-radius: 14px;
65
+ background:rgb(204,204,204);
66
+ transition: all 200ms ease 0s;
67
+ }
68
+ .jdd-switch-show::after {
69
+ position: absolute;
70
+ left: 0;
71
+ top: 0;
72
+ bottom: 0;
73
+ margin: auto 0;
74
+ content: " ";
75
+ height: 23px;
76
+ width: 23px;
77
+ z-index: 2;
78
+ transform: translateX(3px);
79
+ // box-shadow: rgba(0, 0, 0, 0.21) 2px 2px 4px;
80
+ //box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
81
+ border-radius: 100%;
82
+ background: rgb(255, 255, 255);
83
+ transition: all 200ms ease 0s;
84
+ }
85
+ }
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <jdd-field :label="label" :state="validateStatus" :direction="direction" :border="border" class="jdd-field-row">
3
+ <div class="jdd-field-control jdd-field-switch">
4
+ <label for class="jdd-switch" :class="{'jdd-switch-disable':disabled}">
5
+ <input type="checkbox" class="jdd-switch-input" v-model="checkValue" :disabled="disabled">
6
+ <span class="jdd-switch-show"></span>
7
+ </label>
8
+ </div>
9
+ </jdd-field>
10
+ </template>
11
+ <script>
12
+ import jddField from "../../field";
13
+ export default {
14
+ name: "JddSwitch",
15
+ props: {
16
+ value: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ title: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ direction: {
25
+ type: String,
26
+ default: "row"
27
+ },
28
+ disabled: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ border: {
33
+ type: String,
34
+ default: ""
35
+ }
36
+ },
37
+ components: {
38
+ jddField
39
+ },
40
+ data() {
41
+ return {
42
+ checkValue: this.value,
43
+ validateStatus: true,
44
+ label:this.title
45
+ };
46
+ },
47
+ methods: {},
48
+ watch: {
49
+ value(newVal) {
50
+ this.checkValue = newVal;
51
+ },
52
+ checkValue(newVal) {
53
+ this.$emit("change", newVal);
54
+ this.$emit("input", newVal);
55
+ }
56
+ }
57
+ };
58
+ </script>
59
+
60
+
@@ -0,0 +1,8 @@
1
+ import Tabs from './src/tabs.vue';
2
+ import TabItem from './src/tab-item.vue';
3
+ import "./index.scss";
4
+ Tabs.install = function(Vue){
5
+ Vue.component(Tabs.name, Tabs);
6
+ Vue.component(TabItem.name, TabItem);
7
+ }
8
+ export default Tabs;
@@ -0,0 +1,73 @@
1
+ .jdd-tabs {
2
+ &-line {
3
+ height: 50px;
4
+ background-color: #fff;
5
+ //padding: 0 16px;
6
+
7
+
8
+ }
9
+
10
+
11
+ &-list {
12
+ position: relative;
13
+ display: flex;
14
+ height: 100%;
15
+ align-items: center;
16
+ overflow-x: auto;
17
+ overflow-y: hidden;
18
+ -webkit-overflow-scrolling: touch;
19
+
20
+ &::-webkit-scrollbar {
21
+ display: none;
22
+ }
23
+
24
+ }
25
+
26
+ &-hasscroll {
27
+ .jdd-tabs-item {
28
+ // flex: 0 0 22%;
29
+ flex: 0 0 auto;
30
+ }
31
+ }
32
+
33
+ &-list &-active {
34
+
35
+ p {
36
+ color: rgba(51, 51, 51, 1);
37
+ }
38
+ }
39
+ &-active-line {
40
+ display: inline-block;
41
+ position: absolute;
42
+ height: 3px;
43
+ width: 20px;
44
+ bottom: 6px;
45
+ background-color: #333;
46
+ transition: all .2s ease;
47
+ }
48
+ &-item {
49
+ &:first-child {
50
+ padding-left: 16px;
51
+ }
52
+
53
+ &:last-child {
54
+ padding-right: 16px;
55
+ }
56
+
57
+ position: relative;
58
+ flex: 1;
59
+ min-width: 0;
60
+ text-align: center;
61
+ padding: 0 12px;
62
+
63
+ p {
64
+ font-size: 16px;
65
+ font-weight: 500;
66
+ color: rgba(153, 153, 153, 1);
67
+ line-height: 22px;
68
+ overflow: hidden;
69
+ text-overflow: ellipsis;
70
+ white-space: nowrap;
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <div :class="['jdd-tabs-item',parent.value===value?'jdd-tabs-active':'']" @click = "itemSelect" ref="tab">
3
+ <p>{{content}}</p>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "JddTabItem",
10
+ props: {
11
+ value: {
12
+
13
+ },
14
+ content: [String, Number],
15
+ midPos:{
16
+ type: Number,
17
+ default:0
18
+ }
19
+ },
20
+ inject:{
21
+ handleClick: {
22
+ default: 'itemSelect'
23
+ },
24
+ parent: {
25
+ default: this
26
+ }
27
+
28
+ },
29
+ methods: {
30
+ itemSelect() {
31
+ // console.log(typeof this.handleClick)
32
+ if(typeof this.handleClick === 'function') {
33
+ this.handleClick(this.value,this.content,this.$refs.tab.offsetLeft);
34
+ }else{
35
+ this.$emit("click",this.value,this.content)
36
+ }
37
+ }
38
+ }
39
+ }
40
+ </script>