ComTextArea.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div class="comArea" @touchmove.prevent>
  3. <textarea
  4. :style="{width:width,height:height}"
  5. v-model="txt"
  6. placeholder="请输入"
  7. @input="changeVal"></textarea>
  8. <div :class="sure?'realSure sure':'sure'" @click="makeSuer">
  9. 确定
  10. </div>
  11. </div>
  12. </template>
  13. <script type="text/javascript">
  14. import { isIos } from '@utils/tools';
  15. import $ from 'jquery'
  16. export default {
  17. name:'ComTextArea',
  18. props: {
  19. num:{
  20. default:0
  21. },
  22. width: {
  23. default: '100%',
  24. type: String
  25. },
  26. height: {
  27. default: '2rem',
  28. type: String
  29. },
  30. item:{
  31. default:{}
  32. }
  33. },
  34. data() {
  35. return {
  36. txt: this.item.value||'', //回读用
  37. sure:false,
  38. // txt:''
  39. }
  40. },
  41. methods:{
  42. changeVal(e){
  43. this.txt = e.target.value;
  44. const notNull=this.txt.match(/\S/g);
  45. if(notNull){
  46. this.sure=true;
  47. }else{
  48. this.sure=false;
  49. }
  50. },
  51. makeSuer(){
  52. if(!this.sure){return}
  53. let n = this.num;
  54. this.$emit("updata",'',{val:this.txt||'无',valp:this.txt||'无'},++n);
  55. }
  56. },
  57. }
  58. </script>
  59. <style lang="less" scoped>
  60. @import '../less/base.less';
  61. .comArea {
  62. width: 100%;
  63. position:fixed;
  64. bottom:0;
  65. background:#fff;
  66. padding:0.28rem 0 0;
  67. box-shadow: 0 0 30px -10px rgba(104, 124, 189, 0.25);
  68. text-align: center;
  69. textarea {
  70. color: #4F50FF;
  71. resize: none;
  72. box-shadow: none;
  73. font-size: #font[select];
  74. box-sizing: border-box;
  75. border: 1px solid #DFE0E4;
  76. border-radius: .08rem /* 8/100 */;
  77. -webkit-appearance: none;
  78. padding: .16rem /* 16/100 */ .3rem /* 30/100 */;
  79. background-color: transparent;
  80. }
  81. }
  82. </style>