layer.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="modalhtml">
  3. <view class="modal">
  4. <view v-if="title!=''" class="title">{{title}}</view>
  5. <view class="content">
  6. <input class="input" :placeholder="placeholder" v-model="input" />
  7. <view style="text-align: center;padding: 0px 0px;" v-if="isradio">
  8. <radio :checked="rediocheck" @tap="rediocheck=!rediocheck">{{radiotext}}</radio>
  9. </view>
  10. </view>
  11. <view class="btns">
  12. <span @tap="close()" >{{btn_cancle}}</span>
  13. <span @tap="sub()" >{{btn_ok}}</span>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props:{
  21. title:{
  22. default:'',
  23. } ,
  24. btn_cancle:{
  25. default:'取消'
  26. },
  27. btn_ok:{
  28. default:'确认'
  29. },
  30. placeholder:{
  31. default:''
  32. },
  33. value:{
  34. default:''
  35. },
  36. isradio:{
  37. default:false,
  38. },
  39. radiotext:{
  40. default:''
  41. }
  42. },
  43. methods:{
  44. close(){
  45. this.$emit('close')
  46. },
  47. sub(){
  48. this.$emit('sub',{input:this.input,rediocheck:this.rediocheck})
  49. },
  50. },
  51. data() {
  52. return {
  53. input:'',
  54. rediocheck:false,
  55. };
  56. },
  57. mounted() {
  58. this.input=this.value;
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. .modalhtml{
  64. position: fixed;
  65. z-index: 999;
  66. top:0px;
  67. width: 100%;
  68. left: 0px;height: 100vh;
  69. background-color: rgba(0,0,0,0.7);
  70. font-size: 14px;;
  71. }
  72. .modalhtml .modal{
  73. background-color: #fff;
  74. border-radius: 10px;;
  75. top:30vh;
  76. width: 80vw;
  77. left: 10vw;
  78. position: fixed;
  79. border: 1px #ddd solid;
  80. }
  81. .modalhtml .modal .title{
  82. text-align: center;
  83. height: 35px;
  84. line-height: 35px;
  85. color: #000;;
  86. font-size: 16px;;
  87. font-weight: 600;
  88. margin-top: 5px;;
  89. }
  90. .modalhtml .modal .content{
  91. padding: 5px 10px;
  92. max-height: 160px;;
  93. line-height: 30px;;
  94. overflow-y: scroll;
  95. font-size: 14px;
  96. }
  97. .modalhtml .modal .content .input{
  98. height: 30px;
  99. line-height: 30px;
  100. display: inline-block;
  101. padding: 0px 5px;
  102. border: 1px #eee solid;
  103. border-radius: 5px;
  104. font-size: 14px;
  105. width: calc(100% - 12px);
  106. }
  107. .modalhtml .modal .btns{
  108. text-align: center;
  109. height: 35px;
  110. line-height: 35px;
  111. color: #000;;
  112. font-size: 16px;;
  113. font-weight: 600;
  114. border-top: #eee 1px solid;
  115. }
  116. .modalhtml .modal .btns >span{
  117. display: inline-block;
  118. width: calc(50% - 1px);
  119. height: 35px;
  120. line-height: 35px;
  121. }
  122. .modalhtml .modal .btns >span:last-child{
  123. border-left: #eee 1px solid;
  124. color:#2319DC
  125. }
  126. </style>