add.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="container">
  3. <view class="main">
  4. <fs-license-plate v-model="carNo"></fs-license-plate>
  5. </view>
  6. <view class="layout-box">
  7. <fs-button round full @click="handleAdd" :disabled="carNo.length < 6" v-if="type === 'add'">添加车牌</fs-button>
  8. <fs-row v-else>
  9. <fs-col span="6">
  10. <fs-button round block @click="handleEdit">更新车牌</fs-button>
  11. </fs-col>
  12. <fs-col span="6">
  13. <fs-button round block type="danger" @click="handleDel">删除车牌</fs-button>
  14. </fs-col>
  15. </fs-row>
  16. </view>
  17. </view>
  18. </template>
  19. <script setup>
  20. import { ref, onUnmounted } from 'vue'
  21. let carNo = ref('')
  22. let type = ref('add')
  23. if (getApp().globalData.carDetail) {
  24. type.value = 'edit'
  25. carNo.value = getApp().globalData.carDetail
  26. }
  27. const handleAdd = () => {
  28. }
  29. const handleEdit = () => {
  30. }
  31. const handleDel = () => {
  32. uni.showModal({
  33. title: '您确定要删除该车牌吗?'
  34. }).then(res => {
  35. if (res.confirm) {
  36. uni.showToast({
  37. title: '删除成功'
  38. })
  39. setTimeout(() => {
  40. uni.navigateBack()
  41. }, 1500)
  42. }
  43. })
  44. }
  45. onUnmounted(() => {
  46. getApp().globalData.carDetail = null
  47. })
  48. </script>
  49. <style lang="scss">
  50. </style>