nichengDialog.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!-- 小弹窗 一行文字 -->
  2. <template>
  3. <uni-popup ref="tipSmallPopup" :animation="false" :is-mask-click="false"
  4. mask-background-color="rgba(0,0,0, 0.76);">
  5. <view class="ezy-tip-dialog tip-small-dialog duihuan-dialog">
  6. <view class="tip-content-box">
  7. <view class="tip-title">{{title}}</view>
  8. <input class="duihuan-input" type="text" focus v-model="nichengValue" placeholder="请输入昵称" />
  9. <view class="tip-btn-box">
  10. <view class="not-confirm-btn" @click="handleClose">取消</view>
  11. <view class="confirm-btn" @click="confirmBtn">确认</view>
  12. </view>
  13. </view>
  14. </view>
  15. </uni-popup>
  16. </template>
  17. <script setup>
  18. import { ref } from 'vue';
  19. import {
  20. toast,
  21. } from "@/utils/common";
  22. const props = defineProps({
  23. title: {
  24. type: String,
  25. default: '提示'
  26. },
  27. content: {
  28. type: String,
  29. require: true,
  30. default: ''
  31. },
  32. });
  33. const tipSmallPopup = ref(null); // 索引
  34. const nichengValue = ref(''); // 索引
  35. const $emit = defineEmits(['confirm-btn'])
  36. // 打开弹窗
  37. function handleShow() {
  38. tipSmallPopup.value.open();
  39. }
  40. // 取消
  41. function handleClose() {
  42. nichengValue.value = ''
  43. tipSmallPopup.value.close();
  44. }
  45. // 确认
  46. function confirmBtn(){
  47. if (!nichengValue.value) {
  48. toast('请输入昵称')
  49. return;
  50. }
  51. $emit('confirm-btn',nichengValue.value);
  52. tipSmallPopup.value.close();
  53. nichengValue.value = ''
  54. }
  55. defineExpose({
  56. handleShow
  57. })
  58. </script>
  59. <style>
  60. </style>