direction.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="same_row_in upAndDown_padding">
  3. <span class="title_12 w_60 default_size" style="flex: none;">{{title}}</span>
  4. <div class="card_alignment">
  5. <div class="card_item_text" :class="item.flag ? 'activate_text' : ''" v-for="(item, index) in arrList"
  6. :key="index" @click="selectAlignment(item.id)">
  7. <span class="img_icon_text iconfont"
  8. :class="[item.flag ? 'activate_text' : '', item.title]"></span>
  9. </div>
  10. </div>
  11. </div>
  12. </template>
  13. <script setup lang="ts">
  14. import { ref, onMounted } from "vue";
  15. const props = defineProps({
  16. mode: {
  17. type: Boolean,
  18. required: true
  19. },
  20. title: {
  21. type: String,
  22. required: true
  23. },
  24. })
  25. const arrList: any = ref([{
  26. id: true,
  27. flag: false,
  28. title: 'icon-around',
  29. }, {
  30. id: false,
  31. flag: false,
  32. title: 'icon-fluctuate',
  33. }])
  34. onMounted(() => {
  35. selectAlignment(props.mode)
  36. })
  37. const emit = defineEmits(['update:mode']);
  38. function selectAlignment(event: any) {
  39. arrList.value.forEach(item => {
  40. if (item.id == event) {
  41. item.flag = true
  42. } else {
  43. item.flag = false
  44. }
  45. })
  46. emit('update:mode', event);
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .card_alignment {
  51. width: 100%;
  52. background: rgb(243, 243, 248);
  53. border-radius: 4px;
  54. display: flex;
  55. -webkit-box-pack: center;
  56. justify-content: center;
  57. padding: 2px;
  58. height: 24px;
  59. }
  60. .card_item_text {
  61. flex: 1 1 0%;
  62. height: 100%;
  63. text-align: center;
  64. display: flex;
  65. flex-direction: row;
  66. -webkit-box-pack: center;
  67. justify-content: center;
  68. -webkit-box-align: center;
  69. align-items: center;
  70. cursor: pointer;
  71. }
  72. .activate_text {
  73. color: rgb(15, 116, 231) !important;
  74. background: rgb(255, 255, 255);
  75. border-radius: 3px;
  76. font-size: 12px;
  77. cursor: pointer;
  78. }
  79. .img_icon_text {
  80. color: rgb(171, 171, 180);
  81. font-size: 12px;
  82. }
  83. .w_60_index {
  84. width: 60px !important;
  85. margin-right: 5px;
  86. }
  87. </style>