item-text.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="item-line" v-show="isShow" :class="{'line-one':lineType===1,'line-two':lineType===2}">
  3. <view class="item-text">
  4. <view class="item-key">{{label}}</view>
  5. <view class="item-value" v-if="radioType">{{radioData[value+'']}}{{rightText?rightText:''}}</view>
  6. <view class="item-value" v-else>{{value?value:'-'}} {{rightText?rightText:''}}</view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: "item-text",
  13. components: {},
  14. props: {
  15. lineType:{
  16. type:Number,
  17. default:0
  18. },
  19. label: {
  20. type: String,
  21. default: '标题'
  22. },
  23. rightText: {
  24. type: String,
  25. default: ''
  26. },
  27. value: {
  28. default: ''
  29. },
  30. keyStr: {
  31. default: true
  32. },
  33. radioData:{
  34. default:false
  35. },
  36. typeKeys:{
  37. default:[]
  38. }
  39. },
  40. data() {
  41. return {
  42. radioType:false,
  43. isShow:true
  44. }
  45. },
  46. watch: {},
  47. mounted() {
  48. if(this.radioData){
  49. this.radioType=true
  50. }
  51. this.setIsShow()
  52. },
  53. methods: {
  54. setIsShow(){
  55. if(this.keyStr!==true){
  56. if(this.typeKeys.indexOf(this.keyStr)<0){
  57. this.isShow=false
  58. }
  59. }
  60. }
  61. }
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .item-line{
  66. padding: 16rpx 0;
  67. .item-text{
  68. display: flex;
  69. justify-content: space-between;
  70. .item-key{
  71. color: #999999;
  72. font-size: 30rpx;
  73. min-width: 130rpx;
  74. margin-right: 20rpx;
  75. }
  76. .item-value{
  77. color: #333333;
  78. font-size: 30rpx;
  79. }
  80. }
  81. }
  82. .line-one{
  83. padding-top: 0;
  84. }
  85. .line-two{
  86. padding-bottom: 0;
  87. }
  88. </style>