vue2-client 1.16.44 → 1.16.46

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,5 +1,5 @@
1
1
  <template>
2
- <div class="x-title-container">
2
+ <div class="x-title-container" :class="wrapperClassObject">
3
3
  <div
4
4
  v-if="config.type === 'title'"
5
5
  class="x-title"
@@ -18,7 +18,7 @@
18
18
  </template>
19
19
 
20
20
  <script setup>
21
- import { ref, computed, onMounted } from 'vue'
21
+ import { ref, computed, onMounted, useAttrs } from 'vue'
22
22
 
23
23
  const props = defineProps({
24
24
  queryParamsName: {
@@ -50,6 +50,23 @@ const lineStyle = computed(() => {
50
50
  return style
51
51
  })
52
52
 
53
+ // 动态样式开关:通过 $attrs 生成 xtitle-* 类(布尔开关 + size 派生类)
54
+ const attrs = useAttrs()
55
+ const wrapperClassObject = computed(() => {
56
+ const classes = {}
57
+ const booleanStyleKeys = [
58
+ 'center', 'littlefont'
59
+ ]
60
+ booleanStyleKeys.forEach(key => {
61
+ const val = attrs[key]
62
+ const truthy = val === true || val === '' || val === 'true'
63
+ if (truthy) classes[`xtitle-${key}`] = true
64
+ })
65
+ const size = attrs.size
66
+ if (size && typeof size === 'string') classes[`xtitle-size-${size}`] = true
67
+ return classes
68
+ })
69
+
53
70
  const handleClick = () => {
54
71
  if (config.value.clickName) {
55
72
  emit(config.value.clickName)
@@ -90,7 +107,7 @@ onMounted(() => {
90
107
  })
91
108
  </script>
92
109
 
93
- <style scoped>
110
+ <style scoped lang="less">
94
111
  .x-title-container {
95
112
  display: flex;
96
113
  align-items: center;
@@ -99,12 +116,12 @@ onMounted(() => {
99
116
 
100
117
  .x-title {
101
118
  font-size: 18px;
102
- font-weight: bold;
119
+ font-weight: 700;
103
120
  height: 26px;
104
121
  width: 100%;
105
122
  text-align: left;
106
- font-family: "Source Han Sans", sans-serif;
107
- color: #5D5C5C;
123
+ font-family: "Source Han Sans";
124
+ color: #313131;
108
125
  position: relative;
109
126
  }
110
127
 
@@ -120,4 +137,11 @@ onMounted(() => {
120
137
  .x-button-container {
121
138
  text-align: right;
122
139
  }
140
+ .x-title-center {
141
+ text-align: center
142
+ }
143
+ .x-title-littlefont {
144
+ font-size: 16px
145
+ }
146
+
123
147
  </style>