vdesign-ui 0.1.24 → 0.2.0

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.
Files changed (76) hide show
  1. package/dist/components/activityviews/index.vue +14 -12
  2. package/dist/components/button/index.vue +1 -1
  3. package/dist/components/checkbox/checkbox-group/index.vue +2 -1
  4. package/dist/components/checkbox/index.vue +19 -20
  5. package/dist/components/dialog/index.vue +15 -11
  6. package/dist/components/dropdown/index.vue +43 -31
  7. package/dist/components/empty/404-dark.png +0 -0
  8. package/dist/components/empty/404.png +0 -0
  9. package/dist/components/empty/index.vue +30 -2
  10. package/dist/components/empty/network-dark.png +0 -0
  11. package/dist/components/empty/network.png +0 -0
  12. package/dist/components/empty/nocoupons-dark.png +0 -0
  13. package/dist/components/empty/nocoupons.png +0 -0
  14. package/dist/components/empty/nodata-dark.png +0 -0
  15. package/dist/components/empty/nodata.png +0 -0
  16. package/dist/components/empty/nomargin-dark.png +0 -0
  17. package/dist/components/empty/nomargin.png +0 -0
  18. package/dist/components/empty/nonotice-dark.png +0 -0
  19. package/dist/components/empty/nonotice.png +0 -0
  20. package/dist/components/empty/noocomments-dark.png +0 -0
  21. package/dist/components/empty/noocomments.png +0 -0
  22. package/dist/components/empty/noorders-dark.png +0 -0
  23. package/dist/components/empty/noorders.png +0 -0
  24. package/dist/components/empty/noposition-dark.png +0 -0
  25. package/dist/components/empty/noposition.png +0 -0
  26. package/dist/components/empty/nosearch-dark.png +0 -0
  27. package/dist/components/empty/nosearch.png +0 -0
  28. package/dist/components/empty/style.less +4 -0
  29. package/dist/components/footer/index.vue +5 -1
  30. package/dist/components/footnav/footnav-item/index.vue +11 -42
  31. package/dist/components/footnav/index.vue +29 -33
  32. package/dist/components/headnav/index.vue +55 -37
  33. package/dist/components/headnav/style.less +0 -9
  34. package/dist/components/icon/font/iconfont.css +62 -952
  35. package/dist/components/icon/font/iconfont.js +5 -1
  36. package/dist/components/icon/index.vue +26 -18
  37. package/dist/components/input/calcTextareaHeight.js +36 -140
  38. package/dist/components/input/index.vue +107 -109
  39. package/dist/components/input/search/index.vue +18 -22
  40. package/dist/components/input/stepper/index.vue +32 -26
  41. package/dist/components/input/style.less +20 -33
  42. package/dist/components/list/index.vue +57 -69
  43. package/dist/components/list/style.less +20 -92
  44. package/dist/components/loading/img_status_loading_white_ani.svg +155 -0
  45. package/dist/components/loading/img_status_refresh_ani.svg +158 -0
  46. package/dist/components/loading/index.vue +28 -11
  47. package/dist/components/loading/style.less +1 -1
  48. package/dist/components/mixins/clickoutside.js +81 -81
  49. package/dist/components/mixins/outlineConfigPlugin.js +11 -6
  50. package/dist/components/noticebar/index.vue +9 -4
  51. package/dist/components/pagebreak/index.vue +21 -14
  52. package/dist/components/radio/index.vue +164 -135
  53. package/dist/components/radio/radio-group/index.vue +40 -52
  54. package/dist/components/result/index.vue +1 -2
  55. package/dist/components/selector/index.vue +49 -31
  56. package/dist/components/selector/style.less +14 -0
  57. package/dist/components/step-item/index.vue +2 -2
  58. package/dist/components/tabs/index.vue +55 -32
  59. package/dist/components/tabs/tab/index.vue +13 -16
  60. package/dist/components/tag/index.vue +18 -4
  61. package/dist/components/tag/style.less +2 -2
  62. package/dist/components/title/index.vue +11 -8
  63. package/dist/components/title/style.less +6 -0
  64. package/dist/img/img_status_loading_white_ani.b56fcfae.svg +155 -0
  65. package/dist/img/img_status_refresh_ani.d0e59f12.svg +158 -0
  66. package/dist/token.css +8 -0
  67. package/dist/vdesign-ui.common.js +1481 -1354
  68. package/dist/vdesign-ui.css +1 -1
  69. package/dist/vdesign-ui.umd.js +1481 -1354
  70. package/dist/vdesign-ui.umd.min.js +3 -3
  71. package/package.json +1 -1
  72. package/dist/components/loading/loading.png +0 -0
  73. package/dist/components/loading/refresh.png +0 -0
  74. package/dist/img/404-dark.775df5bb.png +0 -0
  75. package/dist/img/network-dark.11a147bb.png +0 -0
  76. package/dist/img/nodata-dark.b0ea0e39.png +0 -0
@@ -9,62 +9,50 @@ import { findComponentsDownward } from '../assist';
9
9
  const prefixCls = 'vd-radio-group';
10
10
 
11
11
  export default {
12
- name: 'vd-radio-group',
13
- props: {
14
- value: {
15
- type: [String, Number],
16
- default: ''
17
- },
18
- type: {
19
- type: String,
20
- default: ''
21
- }
12
+ name: 'vd-radio-group',
13
+ props: {
14
+ // 绑定的值,用于 v-model
15
+ value: {
16
+ type: [String, Number, Boolean],
17
+ default: '',
22
18
  },
23
- data() {
24
- return {
25
- currentValue: this.value,
26
- childrens: []
27
- };
19
+ // 类型,用于样式
20
+ type: String,
21
+ // 是否禁用组内所有单选框
22
+ disabled: Boolean
23
+ },
24
+ computed: {
25
+ // 组容器的类名
26
+ classes() {
27
+ return [
28
+ `${prefixCls}`,
29
+ {
30
+ [`${prefixCls}__${this.type}`]: this.type,
31
+ },
32
+ ];
28
33
  },
29
- computed: {
30
- classes() {
31
- return [
32
- `${prefixCls}`,
33
- {
34
- [`${prefixCls}__${this.type}`]: this.type,
35
- }
36
- ];
37
- }
34
+ },
35
+ methods: {
36
+ // 更新子单选框的状态
37
+ updateValue() {
38
+ const children = findComponentsDownward(this, 'vd-radio');
39
+ if (children.length) {
40
+ children.forEach((child) => {
41
+ child.updateValue();
42
+ });
43
+ }
38
44
  },
39
- mounted() {
40
- this.updateValue();
45
+ // 处理子单选框的变化
46
+ change(name) {
47
+ this.$emit('input', name);
48
+ this.$emit('change', name);
41
49
  },
42
- methods: {
43
- updateValue() {
44
- this.childrens = findComponentsDownward(this, 'vd-radio');
45
- if (this.childrens) {
46
- this.childrens.forEach(child => {
47
- child.currentValue = this.currentValue === child.name;
48
- child.group = true;
49
- });
50
- }
51
- },
52
- change(data) {
53
- this.currentValue = data.value;
54
- this.updateValue();
55
- this.$emit('input', data.value);
56
- this.$emit('change', data.value);
57
- }
50
+ },
51
+ watch: {
52
+ // 监听 value 的变化,更新子组件
53
+ value() {
54
+ this.updateValue();
58
55
  },
59
- watch: {
60
- value() {
61
- if (this.currentValue !== this.value) {
62
- this.currentValue = this.value;
63
- this.$nextTick(() => {
64
- this.updateValue();
65
- });
66
- }
67
- }
68
- }
56
+ },
69
57
  };
70
58
  </script>
@@ -2,10 +2,9 @@
2
2
  <div class="vd-result">
3
3
  <div class="vd-result-img" v-if="currentImg"><img :src="currentImg" alt="img"></div>
4
4
  <div class="vd-result-title" v-if="title">{{ title }}</div>
5
- <p class="vd-result-txt" v-if="text">{{ text }}</p>
5
+ <div class="vd-result-txt" v-if="text">{{ text }}</div>
6
6
  <div class="vd-result-footer">
7
7
  <slot name="btnp"></slot>
8
-
9
8
  <div class="vd-result-footer-btnx" v-if="$slots.btnt">
10
9
  <slot name="btnt"></slot>
11
10
  </div>
@@ -1,7 +1,6 @@
1
1
  <template>
2
- <div class="vd-selector" :class="wrapClasses" :tabindex="disabled ? -1 : 0" @keyup.enter="handlerClick"
3
- @click.stop="handlerClick">
4
- <div class="vd-selector__inner">
2
+ <div v-clickoutside="close" class="vd-selector" :class="wrapClasses" :tabindex="disabled ? -1 : 0">
3
+ <div class="vd-selector__inner" @click.stop="handlerClick">
5
4
  <div :contenteditable="contenteditable" class="vd-selector__left">
6
5
  <vd-icon v-if="icon" :name="icon" svg :class="iconClasses"></vd-icon>
7
6
  <div :class="titleClasses">
@@ -12,73 +11,73 @@
12
11
  </div>
13
12
  <vd-icon v-if="arrow" :name="arrow" :class="arrowClasses"></vd-icon>
14
13
  </div>
15
- <slot v-if="showMenu"></slot>
14
+ <div class="vd-selector--slot">
15
+ <slot name="dropdown"></slot>
16
+ </div>
16
17
  </div>
17
18
  </template>
18
19
 
19
20
  <script>
21
+ import clickoutside from "../mixins/clickoutside.js";
20
22
  const prefixCls = 'vd-selector';
21
23
 
22
24
  export default {
23
25
  name: 'vd-selector',
26
+ directives: {
27
+ clickoutside
28
+ },
24
29
  props: {
25
- // 图标名称
26
30
  icon: {
27
31
  type: String,
28
32
  default: ''
29
33
  },
30
- // 箭头图标名称或布尔值(是否显示箭头)
31
34
  arrow: {
32
- type: [String, Boolean],
35
+ type: String,
33
36
  default: 'icon_btn_moredown'
34
37
  },
35
- // 组件类型(用于自定义样式)
36
38
  type: {
37
39
  type: String,
38
- default: '' // form
40
+ default: '',
41
+ validator: value => ['', 'form'].includes(value)
39
42
  },
40
- // 组件尺寸
41
43
  size: {
42
44
  type: String,
43
45
  default: 'm',
44
46
  validator: value => ['s', 'm', 'l', 'xl'].includes(value)
45
47
  },
46
- // 组件内容
47
48
  content: {
48
- type: [String, Array],
49
+ type: String,
49
50
  default: ''
50
51
  },
51
- // 是否禁用组件
52
52
  disabled: {
53
53
  type: Boolean,
54
54
  default: false
55
55
  },
56
- // 是否激活组件
57
56
  active: {
58
57
  type: Boolean,
59
58
  default: false
60
59
  },
61
- // 是否允许编辑内容
62
60
  contenteditable: {
63
61
  type: Boolean,
64
62
  default: false
65
63
  },
66
- // 是否显示子菜单
67
64
  value: {
68
65
  type: Boolean,
69
66
  default: false
67
+ },
68
+ name: {
69
+ type: String,
70
+ default: ''
71
+ },
72
+ },
73
+ watch: {
74
+ value(val) {
75
+ this.showMenu = val;
70
76
  }
71
77
  },
72
78
  data() {
73
79
  return {
74
- // 是否显示子菜单
75
- showMenu: false
76
- }
77
- },
78
- watch: {
79
- // 监听 value 属性变化,同步更新 showMenu
80
- value(newVal) {
81
- this.showMenu = newVal;
80
+ showMenu: this.value
82
81
  }
83
82
  },
84
83
  computed: {
@@ -117,19 +116,38 @@ export default {
117
116
  },
118
117
  },
119
118
  methods: {
120
- // 关闭子菜单
119
+ generateClasses(suffix = '', extra = '') {
120
+ return {
121
+ [`${prefixCls}-${this.type}${suffix}`]: this.type,
122
+ [`${prefixCls}-${this.size}${suffix}`]: this.size,
123
+ [`${prefixCls}${extra}`]: extra,
124
+ [`${prefixCls}--disabled`]: this.disabled,
125
+ [`${prefixCls}--active`]: this.showMenu || this.active,
126
+ [`${prefixCls}-${this.size}${suffix}--active`]: this.showMenu && this.arrow,
127
+ };
128
+ },
121
129
  close() {
122
- this.showMenu = false;
123
- this.$emit('close', false);
124
- this.$emit('input', false);
130
+ if (this.showMenu) {
131
+ // this.showMenu = false;
132
+ // this.$emit('close');
133
+ // 传了下拉菜单才执行
134
+ if (this.$scopedSlots.dropdown) {
135
+ console.log('has dropdown')
136
+ this.$emit('input', false);
137
+ }
138
+ }
125
139
  },
126
- // 处理点击事件
127
140
  handlerClick() {
128
141
  if (this.disabled) return;
142
+ console.log('showMenu:1:', this.showMenu);
143
+ // 更新showMenu的值
129
144
  this.showMenu = !this.showMenu;
130
- // this.$emit('input', this.showMenu);
131
- this.$emit('click', this.showMenu);
145
+ console.log('showMenu:2:', this.showMenu);
146
+ // 使用$emit来更新v-model绑定的值
147
+ this.$emit('input', this.showMenu);
148
+ this.$emit('click');
132
149
  }
150
+
133
151
  }
134
152
  };
135
153
  </script>
@@ -58,6 +58,7 @@
58
58
  }
59
59
 
60
60
  &__icon {
61
+ display: flex;
61
62
  font-size: calc(var(--icon-selector-xl) * 1px);
62
63
  margin-inline-end: calc(var(--spacing-selector-xl-margin_y) * 1px);
63
64
 
@@ -108,6 +109,7 @@
108
109
  }
109
110
 
110
111
  &__icon {
112
+ display: flex;
111
113
  font-size: calc(var(--icon-selector-l) * 1px);
112
114
  margin-inline-end: calc(var(--spacing-selector-l-margin_y) * 1px);
113
115
 
@@ -157,6 +159,7 @@
157
159
  }
158
160
 
159
161
  &__icon {
162
+ display: flex;
160
163
  font-size: calc(var(--icon-selector-m) * 1px);
161
164
  margin-inline-end: calc(var(--spacing-selector-m-margin_y) * 1px);
162
165
 
@@ -205,6 +208,7 @@
205
208
  }
206
209
 
207
210
  &__icon {
211
+ display: flex;
208
212
  font-size: calc(var(--icon-selector-s) * 1px);
209
213
  margin-inline-end: calc(var(--spacing-selector-s-margin_y) * 1px);
210
214
 
@@ -298,6 +302,12 @@
298
302
  }
299
303
  }
300
304
 
305
+ &--slot {
306
+ position: absolute;
307
+ top: 100%;
308
+ display: none;
309
+ }
310
+
301
311
  &--active {
302
312
  .@{selector-prefix-cls}-xl {
303
313
 
@@ -372,6 +382,10 @@
372
382
  transition: transform .3s;
373
383
  }
374
384
  }
385
+
386
+ .@{selector-prefix-cls}--slot {
387
+ display: block;
388
+ }
375
389
  }
376
390
 
377
391
  &--disabled {
@@ -70,9 +70,9 @@ export default {
70
70
  },
71
71
  iconName() {
72
72
  if (this.state === 'afoot') {
73
- return this.currentTheme === 'dark' ? 'icon_show_steping1' : 'icon_show_steping'
73
+ return this.currentTheme === 'dark' ? 'icon_show_steping1_svg' : 'icon_show_steping_svg'
74
74
  } else if (this.state === 'warning') {
75
- return this.currentTheme === 'dark' ? 'icon_show_stepwrong1' : 'icon_show_stepwrong'
75
+ return this.currentTheme === 'dark' ? 'icon_show_stepwrong1_svg' : 'icon_show_stepwrong_svg'
76
76
  }
77
77
  return ''
78
78
  }
@@ -2,14 +2,15 @@
2
2
  <div class="vd-tabs">
3
3
  <div class="vd-tabs__wrap" :class="menuClasses" ref="tabsWrap">
4
4
  <div :class="[barType,scrollspy]" ref="tabsContainer">
5
- <div v-for="(item, index) in navList" :key="index" :class="tabClasses(item)" @click="handleChange(index)">
6
- <span class="vd-tabs-text-cell" :class="ellipsisClasses">{{ item.title }}
5
+ <div v-for="(item, index) in navList" :key="index" :class="[tabClasses(item), lineClasses]" @click="handleChange(index)">
6
+ <span class="vd-tabs-text-cell" :class="ellipsisClasses">
7
+ {{ item.title }}
7
8
  <vd-icon class="vd-tabs-arrow" v-if="item.arrow" name="icon_btn_moredown"></vd-icon>
8
9
  </span>
9
10
  </div>
10
11
  </div>
11
12
  <div class="vd-tabs-menu--right" v-if="menu">
12
- <vd-icon :name="menuIcon" class="vd-tabs-menu-btn" @click="emitMenuClick"></vd-icon>
13
+ <vd-icon :name="menuIconComputed" class="vd-tabs-menu-btn" @click="emitMenuClick"></vd-icon>
13
14
  </div>
14
15
  </div>
15
16
  <div class="vd-tabs__content">
@@ -28,7 +29,11 @@ export default {
28
29
  type: String,
29
30
  default: "primary",
30
31
  },
31
- menu: Boolean,
32
+ // 将 menu 作为一个字段,同时控制显示和图标名称
33
+ menu: {
34
+ type: [Boolean, String],
35
+ default: false,
36
+ },
32
37
  ellipsis: {
33
38
  type: Boolean,
34
39
  default: true,
@@ -36,31 +41,40 @@ export default {
36
41
  actBorder: Boolean,
37
42
  backgroundColor: Boolean,
38
43
  divider: Boolean,
39
- menuIcon: {
40
- type: String,
41
- default: 'icon_tab_morelist',
42
- },
43
44
  },
44
45
  data() {
45
46
  return {
46
- currentValue: this.value,
47
- navList: [],
47
+ currentValue: this.value, // 当前选中的标签名
48
+ navList: [], // 标签导航列表
49
+ tabs: [], // 已注册的标签
48
50
  };
49
51
  },
50
52
  watch: {
53
+ // 监听 value 变化,更新 currentValue
51
54
  value(val) {
52
55
  this.currentValue = val;
53
56
  },
54
57
  },
55
58
  computed: {
59
+ // 计算菜单按钮的图标,根据 menu 属性的类型决定图标
60
+ menuIconComputed() {
61
+ if (typeof this.menu === 'string') {
62
+ return this.menu;
63
+ } else {
64
+ return 'icon_tab_morelist'; // 默认的菜单图标名称
65
+ }
66
+ },
67
+ // 计算滚动监视的类名
56
68
  scrollspy() {
57
69
  return `${prefixCls}--complete`
58
70
  },
71
+ // 计算标签文字是否需要省略号的类名
59
72
  ellipsisClasses() {
60
73
  return {
61
74
  [`${prefixCls}-text--ellipsis`]: this.ellipsis,
62
75
  };
63
76
  },
77
+ // 计算标签包裹器的类名,根据 menu、backgroundColor 和 divider 属性来确定
64
78
  menuClasses() {
65
79
  return {
66
80
  [`${prefixCls}-menu`]: this.menu,
@@ -68,11 +82,13 @@ export default {
68
82
  "vd-hairline--bottom": this.divider,
69
83
  };
70
84
  },
85
+ // 计算标签下方线条的类名
71
86
  lineClasses() {
72
87
  return {
73
88
  [`${prefixCls}__line`]: !this.actBorder,
74
89
  };
75
90
  },
91
+ // 根据 tabsType 属性计算标签类型的类名
76
92
  barType() {
77
93
  return {
78
94
  [`${prefixCls}-${this.tabsType}-bar`]: this.tabsType,
@@ -80,45 +96,54 @@ export default {
80
96
  },
81
97
  },
82
98
  methods: {
99
+ // 当菜单按钮被点击时触发事件
83
100
  emitMenuClick() {
84
101
  this.$emit('menu-click');
85
102
  },
103
+ // 计算每个标签项的类名
86
104
  tabClasses(item) {
87
105
  return {
88
106
  [`${prefixCls}-${this.tabsType}`]: true,
89
107
  [`${prefixCls}-${this.tabsType}-active`]: item.name === this.currentValue,
90
108
  };
91
109
  },
92
- getTabs() {
93
- return this.$children.filter((item) => item.$options.name === "vd-tab");
110
+ // 注册新的标签到 tabs 数组中
111
+ registerTab(tab) {
112
+ if (!this.tabs.includes(tab)) {
113
+ this.tabs.push(tab);
114
+ this.updateNav();
115
+ }
94
116
  },
117
+ // 从 tabs 数组中注销一个标签
118
+ unregisterTab(tab) {
119
+ const index = this.tabs.indexOf(tab);
120
+ if (index !== -1) {
121
+ this.tabs.splice(index, 1);
122
+ this.updateNav();
123
+ }
124
+ },
125
+ // 根据已注册的标签更新导航列表
95
126
  updateNav() {
96
- this.navList = this.getTabs().map((pane, index) => ({
97
- title: pane.title,
98
- name: pane.name || index,
99
- arrow: pane.arrow,
127
+ this.navList = this.tabs.map((tab, index) => ({
128
+ title: tab.title,
129
+ name: tab.name != null ? tab.name : index,
130
+ arrow: tab.arrow,
100
131
  }));
101
- if (!this.currentValue) {
132
+ // 如果当前没有选中的标签且导航列表不为空,则将第一个标签设为当前值
133
+ if (!this.currentValue && this.navList.length) {
102
134
  this.currentValue = this.navList[0].name;
103
135
  }
104
- this.updateStatus();
105
- },
106
- updateStatus() {
107
- this.getTabs().forEach((tab) => {
108
- tab.show = tab.computedName === this.currentValue;
109
- });
110
136
  },
111
137
  handleChange(index) {
112
138
  const nav = this.navList[index];
113
139
  const name = nav.name;
114
140
  if (this.currentValue !== name) {
115
141
  this.currentValue = name;
116
- this.$emit('input', name); // 确保向父组件更新
117
- this.$emit('change', { index, title: nav.title, name });
118
- this.updateStatus(); // 确保更新状态
119
- this.adjustTabPosition(index);
142
+ this.$emit("input", name); // 触发 input 事件,更新父组件中的 v-model 绑定值
143
+ this.$emit("change", { index, title: nav.title, name }); // 触发 change 事件,传递标签的详细信息
144
+ this.adjustTabPosition(index); // 调整选中标签的位置
120
145
  }
121
- this.$emit("click", { index, title: nav.title, name });
146
+ this.$emit("click", { index, title: nav.title, name }); // 触发 click 事件,传递标签的详细信息
122
147
  },
123
148
  adjustTabPosition(index) {
124
149
  const container = this.$refs.tabsContainer;
@@ -133,13 +158,11 @@ export default {
133
158
  },
134
159
  },
135
160
  mounted() {
136
- this.updateNav();
161
+ // 组件挂载后更新导航列表
162
+ // this.updateNav();
137
163
  },
138
164
  };
139
165
  </script>
140
-
141
- <style lang="less"></style>
142
-
143
166
  <style lang="less">
144
167
  @import "./style.less";
145
168
  </style>
@@ -20,35 +20,32 @@ export default {
20
20
  },
21
21
  data() {
22
22
  return {
23
- show: false,
24
23
  };
25
24
  },
26
25
  watch: {
27
- title() {
28
- this.updateNav();
29
- },
30
- name() {
31
- this.updateNav();
32
- },
26
+
33
27
  },
34
28
  computed: {
29
+ isActive() {
30
+ return this.computedName === this.$parent.currentValue;
31
+ },
35
32
  tabClasses() {
36
33
  return {
37
34
  'vd-tab': true,
38
- 'vd-tab-active': this.show,
35
+ 'vd-tab-active': this.isActive,
39
36
  };
40
37
  },
41
38
  computedName() {
42
- return this.name ?? this.$parent.getTabs().indexOf(this);
43
- },
39
+ return this.name != null
40
+ ? this.name
41
+ : this.$parent.tabs.indexOf(this);
42
+ },
44
43
  },
45
- methods: {
46
- updateNav() {
47
- this.$parent.updateNav();
48
- },
44
+ created() {
45
+ this.$parent.registerTab(this);
49
46
  },
50
- mounted() {
51
- this.updateNav();
47
+ beforeDestroy() {
48
+ this.$parent.unregisterTab(this);
52
49
  },
53
50
  };
54
51
  </script>
@@ -1,6 +1,5 @@
1
1
  <template>
2
- <!-- {{text}} 改成v-html -->
3
- <div class="vd-tag" :class="classes">
2
+ <div class="vd-tag" :class="classes" @click="handleClick">
4
3
  <slot>{{ text }}</slot>
5
4
  </div>
6
5
  </template>
@@ -14,10 +13,20 @@ export default {
14
13
  type: {
15
14
  type: String,
16
15
  // white、dark、blue、cyan、green、olive、yellow、orange、red、pink、purple
17
- default: ''
16
+ default: '',
17
+ validator(value) {
18
+ return [
19
+ 'white', 'dark', 'blue', 'cyan', 'green',
20
+ 'olive', 'yellow', 'orange', 'red', 'pink', 'purple',
21
+ ].includes(value);
22
+ },
18
23
  },
19
24
  size: {
20
25
  type: String,
26
+ required: true,
27
+ validator(value) {
28
+ return ['s', 'l'].includes(value);
29
+ },
21
30
  },
22
31
  borders: {
23
32
  type: Boolean,
@@ -41,7 +50,12 @@ export default {
41
50
  return classes
42
51
 
43
52
  },
44
- }
53
+ },
54
+ methods: {
55
+ handleClick(event) {
56
+ this.$emit('click', event);
57
+ },
58
+ },
45
59
  }
46
60
  </script>
47
61
 
@@ -6,13 +6,13 @@
6
6
  border-radius: calc(var(--radius-tag-bg) * 1px);
7
7
  padding: 0 calc(var(--spacing-tag-padding_y) * 1px);
8
8
 
9
- &--small{
9
+ &--s{
10
10
  font-size: calc(var(--en-single-f-b-s-fontSize) * 1px);
11
11
  font-weight: var(--en-single-f-b-s-fontWeight);
12
12
  height: calc(var(--height-tag-s) * 1px);
13
13
  }
14
14
 
15
- &--large{
15
+ &--l{
16
16
  font-size: calc(var(--en-single-f-b-r-fontSize) * 1px);
17
17
  font-weight: var(--en-single-f-b-r-fontWeight);
18
18
  height: calc(var(--height-tag-m) * 1px);
@@ -2,9 +2,9 @@
2
2
  <div :class="['vd-title', wrapClasses]" @click="handleClick">
3
3
  <div class="vd-title--left">
4
4
  <div class="vd-title-content">
5
- <vd-icon v-if="leftIcon" :name="leftIcon" :svg="leftSvg" :class="leftIconClasses"></vd-icon>
5
+ <vd-icon v-if="leftIcon" :name="leftIcon" :class="leftIconClasses"></vd-icon>
6
6
  <span :class="['vd-title-inner__title', innerTitleClasses]">{{ title }}</span>
7
- <vd-icon v-if="rightIcon" :name="rightIcon" :svg="rightSvg" :class="rightIconClasses"></vd-icon>
7
+ <vd-icon v-if="rightIcon" :name="rightIcon" :class="rightIconClasses"></vd-icon>
8
8
  </div>
9
9
  <p v-if="subText" :class="['vd-title__subtext', subTextClasses]">{{ subText }}</p>
10
10
  </div>
@@ -22,18 +22,20 @@ const prefixCls = 'vd-title';
22
22
  export default {
23
23
  name: 'vd-title',
24
24
  props: {
25
+ type: {
26
+ type: String,
27
+ default: 'primary'
28
+ },
25
29
  title: String,
26
30
  leftIcon: String,
27
31
  rightIcon: String,
28
32
  arrow: Boolean,
29
33
  subText: String,
30
34
  guideText: String,
31
- type: {
32
- type: String,
33
- default: 'primary'
34
- },
35
- leftSvg: Boolean,
36
- rightSvg: Boolean,
35
+ sticky: {
36
+ type: Boolean,
37
+ default: false
38
+ }
37
39
 
38
40
  },
39
41
  data() {
@@ -46,6 +48,7 @@ export default {
46
48
  return {
47
49
  [`${prefixCls}-${this.type}`]: this.type,
48
50
  [`${prefixCls}-${this.type}-double`]: this.subText,
51
+ [`${prefixCls}--sticky`]: this.sticky
49
52
  }
50
53
 
51
54
  },
@@ -14,6 +14,12 @@
14
14
  // display: flex;
15
15
  // flex-direction: column;
16
16
  // }
17
+
18
+ &--sticky {
19
+ position: sticky;
20
+ top: 0;
21
+ z-index: 1000;
22
+ }
17
23
 
18
24
  &--right{
19
25
  display: flex;