Specifications.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view>
  3. <view v-for="(item, index) in formList" :key="index">
  4. <view class="flex_c_s">
  5. <view class="flex_c_l certification-title">
  6. <text class="text-red" v-if="viewStatus">*</text>请填写规格信息({{index + 1}}/5)
  7. </view>
  8. <view @click="clickMenu" class="flex_c_l" v-if="index === 0">
  9. <view :class="[status ? 'icon-complete' : 'icon-manage']"></view>
  10. <view :class="[status ? 'complete-font' : 'manage-font']">{{ status ? '完成' : '管理' }}</view>
  11. </view>
  12. <view @click="clickDelete(index)" class="flex_c_l" v-if="index !== 0 && status">
  13. <view class="icon-delete"></view>
  14. <view class="manage-font">删除</view>
  15. </view>
  16. </view>
  17. <Form :form="item"></Form>
  18. </view>
  19. <view class="footer-add flex_c_c" @click="addForm" v-if="status && (formList.length < 5)">
  20. <view class="icon-add"></view>
  21. <view class="manage-font">添加</view>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup>
  26. import { computed, ref } from 'vue';
  27. import { provide, inject } from 'vue'
  28. import Form from './Form.vue';
  29. const formData = inject('formData');
  30. const props = defineProps({
  31. viewStatus: {
  32. type: Boolean,
  33. default: true
  34. },
  35. })
  36. const status = ref(false);//true:完成 false:管理
  37. const formList = computed(() => {
  38. return formData.businessSpecifications ;
  39. });
  40. const clickMenu = () => {
  41. status.value = !status.value;
  42. }
  43. const addForm = () => {
  44. formData.businessSpecifications.push({});
  45. }
  46. const clickDelete = (index) => {
  47. formData.businessSpecifications.splice(index, 1);
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. @import "./index.scss";
  52. .complete-font {
  53. font-family: 思源黑体;
  54. font-size: 30rpx;
  55. font-weight: 500;
  56. line-height: 30rpx;
  57. text-align: right;
  58. letter-spacing: normal;
  59. color: #FA5700;
  60. }
  61. .manage-font {
  62. font-family: Source Han Sans;
  63. font-size: 30rpx;
  64. font-weight: normal;
  65. line-height: 30rpx;
  66. text-align: right;
  67. letter-spacing: normal;
  68. color: rgba(19, 15, 38, 0.5);
  69. }
  70. .footer-add {
  71. padding: 30rpx 0;
  72. }
  73. </style>
  74. <style>
  75. .form-input {
  76. font-family: PingFang SC;
  77. font-size: 32rpx;
  78. line-height: 44rpx;
  79. color: #130F26;
  80. width: 100% !important;
  81. }
  82. .form-placeholder {
  83. color: #C9CDD4;
  84. }
  85. .skillDescribe-conten {
  86. padding: 32rpx;
  87. }
  88. </style>