You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Setting.vue 6.9 kB

2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <script setup>
  2. const props = defineProps({
  3. settingData: {
  4. type: Array,
  5. default: () => [],
  6. },
  7. settingName: {
  8. type: String,
  9. default: '',
  10. },
  11. })
  12. const emit = defineEmits(['update:settingData'])
  13. watch(() => props.settingData, () => {
  14. emit('update:settingData', props.settingData)
  15. }, {
  16. deep: true,
  17. })
  18. const handleChange = () => {
  19. }
  20. const { t } = useI18n()
  21. </script>
  22. <template>
  23. <div>
  24. <div class="setting-title text-left text-2xl ml-10">
  25. {{ t(props.settingName) }}:
  26. </div>
  27. <div class="setting-items my-3 py-2 border mx-5 rounded-md">
  28. <div v-for="item in props.settingData" :key="item" class="setting-item my-1">
  29. <div v-if="Array.isArray(item.status)" class="flex justify-between mx-8">
  30. <div class="setting-item-title self-center flex justify-center items-center" :data-tip="item.description" :class="!!item.description ? 'tooltip tooltip-primary tooltip-right' : ''">
  31. {{ t(item.name) }}<div v-if="!!item.description" i-carbon-information class="ml-1 " />
  32. </div>
  33. <!-- <select class="select select-sm max-w-xs">
  34. <option v-for="item_ in item.status" :key="item_" :selected="item_.status">
  35. {{ item_.name }}
  36. </option>
  37. </select> -->
  38. <d-select v-model:options="item.status" class="select select-sm max-w-xs" />
  39. </div>
  40. <div v-else class="flex justify-between mx-8 items-center">
  41. <div class="setting-item-title self-center flex justify-center items-center " :data-tip="item.description" :class="!!item.description ? 'tooltip tooltip-primary tooltip-right' : ''">
  42. {{ t(item.name) }}<div v-if="!!item.description" i-carbon-information class="ml-1 " />
  43. </div>
  44. <div class="tooltip tooltip-primary tooltip-left" :data-tip="item.status">
  45. <input v-model="item.status" type="range" min="0" max="1" class="range range-xs" step="0.05">
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <style scoped>
  53. .input-group > *,
  54. .input-group > .input,
  55. .input-group > .select {
  56. border-radius: 0px;
  57. }
  58. .select {
  59. display: inline-flex;
  60. flex-shrink: 0;
  61. cursor: pointer;
  62. user-select: none;
  63. appearance: none;
  64. height: 3rem/* 48px */;
  65. padding-left: 1rem/* 16px */;
  66. padding-right: 2.5rem/* 40px */;
  67. padding-right: 2.5rem/* 40px */;
  68. font-size: 0.875rem/* 14px */;
  69. line-height: 1.25rem/* 20px */;
  70. line-height: 2;
  71. min-height: 3rem/* 48px */;
  72. border-width: 1px;
  73. border-color: hsl(var(--bc) / var(--tw-border-opacity));
  74. --tw-border-opacity: 0;
  75. --tw-bg-opacity: 1;
  76. background-color: hsl(var(--b1) / var(--tw-bg-opacity));
  77. font-weight: 600;
  78. transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
  79. transition-duration: 200ms;
  80. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  81. border-radius: var(--rounded-btn, 0.5rem);
  82. background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  83. background-position: calc(100% - 20px) calc(1px + 50%), calc(100% - 16px) calc(1px + 50%);
  84. background-size: 4px 4px, 4px 4px;
  85. background-repeat: no-repeat;
  86. }
  87. .select[multiple] {
  88. height: auto;
  89. }
  90. .select:focus {
  91. outline: 0px solid hsla(var(--bc) / 0.2);
  92. outline-offset: 2px;
  93. }
  94. .select-disabled,
  95. .select[disabled] {
  96. cursor: not-allowed;
  97. --tw-border-opacity: 1;
  98. border-color: hsl(var(--b2, var(--b1)) / var(--tw-border-opacity));
  99. --tw-bg-opacity: 1;
  100. background-color: hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity));
  101. --tw-text-opacity: 0.2;
  102. }
  103. .select-disabled::placeholder,
  104. .select[disabled]::placeholder {
  105. color: hsl(var(--bc) / var(--tw-placeholder-opacity));
  106. --tw-placeholder-opacity: 0.2;
  107. }
  108. .select-multiple,
  109. .select[multiple],
  110. .select[size].select:not([size="1"]) {
  111. background-image: none;
  112. padding-right: 1rem/* 16px */;
  113. }
  114. .select-multiple,
  115. .select[multiple],
  116. .select[size].select:not([size="1"]) {
  117. background-image: none;
  118. padding-right: 1rem/* 16px */;
  119. }
  120. .select-multiple,
  121. .select[multiple],
  122. .select[size].select:not([size="1"]) {
  123. background-image: none;
  124. padding-right: 1rem/* 16px */;
  125. }
  126. .select-sm {
  127. height: 2rem/* 32px */;
  128. padding-left: 0.75rem/* 12px */;
  129. padding-right: 2rem/* 32px */;
  130. font-size: 0.875rem/* 14px */;
  131. line-height: 2rem/* 32px */;
  132. min-height: 2rem/* 32px */;
  133. }
  134. [dir="rtl"] .select-sm {
  135. padding-right: 0.75rem/* 12px */;
  136. padding-left: 2rem/* 32px */;
  137. }
  138. .range {
  139. height: 1.5rem/* 24px */;
  140. width: 8rem;
  141. cursor: pointer;
  142. appearance: none;
  143. -webkit-appearance: none;
  144. --range-shdw: var(--bc);
  145. overflow: hidden;
  146. background-color: transparent;
  147. border-radius: var(--rounded-box, 1rem);
  148. }
  149. .range:focus {
  150. outline: none;
  151. }
  152. .range:focus-visible::-webkit-slider-thumb {
  153. --focus-shadow: 0 0 0 6px hsl(var(--b1)) inset, 0 0 0 2rem hsl(var(--range-shdw)) inset;
  154. }
  155. .range:focus-visible::-moz-range-thumb {
  156. --focus-shadow: 0 0 0 6px hsl(var(--b1)) inset, 0 0 0 2rem hsl(var(--range-shdw)) inset;
  157. }
  158. .range::-webkit-slider-runnable-track {
  159. height: 0.5rem/* 8px */;
  160. width: 100%;
  161. border-radius: var(--rounded-box, 1rem);
  162. background-color: hsla(var(--bc) / 0.1);
  163. }
  164. .range::-moz-range-track {
  165. height: 0.5rem/* 8px */;
  166. width: 100%;
  167. border-radius: var(--rounded-box, 1rem);
  168. background-color: hsla(var(--bc) / 0.1);
  169. }
  170. .range::-webkit-slider-thumb {
  171. background-color: hsl(var(--b1));
  172. position: relative;
  173. height: 1.5rem/* 24px */;
  174. width: 1.5rem/* 24px */;
  175. border-style: none;
  176. border-radius: var(--rounded-box, 1rem);
  177. appearance: none;
  178. -webkit-appearance: none;
  179. top: 50%;
  180. color: hsl(var(--range-shdw));
  181. transform: translateY(-50%);
  182. --filler-size: 100rem/* 1600px */;
  183. --filler-offset: 0.6rem/* 9.6px */;
  184. box-shadow: 0 0 0 3px hsl(var(--range-shdw)) inset, var(--focus-shadow, 0 0), calc(var(--filler-size) * -1 - var(--filler-offset)) 0 0 var(--filler-size);
  185. }
  186. .range::-moz-range-thumb {
  187. background-color: hsl(var(--b1));
  188. position: relative;
  189. height: 1.5rem/* 24px */;
  190. width: 1.5rem/* 24px */;
  191. border-style: none;
  192. border-radius: var(--rounded-box, 1rem);
  193. top: 50%;
  194. color: hsl(var(--range-shdw));
  195. --filler-size: 100rem/* 1600px */;
  196. --filler-offset: 0.5rem/* 8px */;
  197. box-shadow: 0 0 0 3px hsl(var(--range-shdw)) inset, var(--focus-shadow, 0 0), calc(var(--filler-size) * -1 - var(--filler-offset)) 0 0 var(--filler-size);
  198. }
  199. .range-xs {
  200. height: .5rem/* 16px */;
  201. }
  202. .range-xs::-webkit-slider-runnable-track {
  203. height: 0.125rem/* 4px */;
  204. }
  205. .range-xs::-moz-range-track {
  206. height: 0.125rem/* 4px */;
  207. }
  208. .range-xs::-webkit-slider-thumb {
  209. height: .5rem/* 16px */;
  210. width: .5rem/* 16px */;
  211. --filler-offset: 0.2rem/* 6.4px */;
  212. }
  213. .range-xs::-moz-range-thumb {
  214. height: .5rem/* 16px */;
  215. width: .5rem/* 16px */;
  216. --filler-offset: 0.2rem/* 6.4px */;
  217. }
  218. </style>