addVehicle.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view>
  3. <u-navbar
  4. title-color="#fff"
  5. :custom-back="customBack"
  6. :border-bottom="false"
  7. back-icon-color="#CCE8FF"
  8. :background="{background: '#008CFF' }" title="新增免密支付车牌"></u-navbar>
  9. <view class="new-plate-number">
  10. <view class="message-input-wrap" @click="messageInputClick">
  11. <u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true" v-model="newPlateNumber"></u-message-input>
  12. </view>
  13. <u-keyboard ref="uKeyboard" mode="car" @change="keyboardChange" @confirm="keyboardConfirm" @backspace="backspace" v-model="keyboardshow"></u-keyboard>
  14. </view>
  15. <u-toast ref="uToast" />
  16. <u-modal v-model="delCarshow" :show-cancel-button="true" @confirm="confirmDelCar" :content="delCarContent"></u-modal>
  17. <u-action-sheet :list="colorList" @click="confirmColor" v-model="colorShow"></u-action-sheet>
  18. </view>
  19. </template>
  20. <script>
  21. export default{
  22. data(){
  23. return{
  24. keyboardshow:false,
  25. delCarshow:false,
  26. colorShow:false,
  27. delCarContent:'',
  28. colorList:[
  29. {text:'蓝色',colorCode:0}
  30. ,{text:'黄色',colorCode:1}
  31. ,{text:'黑色',colorCode:2}
  32. ,{text:'白色',colorCode:3}
  33. ,{text:'绿色',colorCode:4}
  34. ,{text:'其他',colorCode:99}
  35. ],
  36. }
  37. },
  38. methods:{
  39. customBack(){
  40. this.$u.route({
  41. type:'switchTab',
  42. url: 'pages/index/index'
  43. });
  44. },
  45. messageInputClick(){
  46. this.keyboardshow = true;
  47. },
  48. // 按键被点击(点击退格键不会触发此事件)
  49. keyboardChange(val) {
  50. // 将每次按键的值拼接到value变量中,注意+=写法
  51. this.newPlateNumber += val;
  52. console.log(this.newPlateNumber);
  53. },
  54. // 退格键被点击
  55. backspace() {
  56. // 删除value的最后一个字符
  57. if(this.newPlateNumber.length) this.newPlateNumber = this.newPlateNumber.substr(0, this.newPlateNumber.length - 1);
  58. console.log(this.newPlateNumber);
  59. },
  60. keyboardConfirm(){
  61. this.colorShow = true;
  62. },
  63. confirmColor(e){
  64. this.vehicleColor = this.colorList[e].colorCode;
  65. },
  66. }
  67. }
  68. </script>
  69. <style>
  70. </style>