优化
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!-- 取餐号组件 -->
|
||||
<template>
|
||||
<el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne">
|
||||
<el-input :type="props.type" v-model="number" :placeholder="props.placeholder" readonly></el-input>
|
||||
<el-input :type="props.inputType" v-model="number" :placeholder="props.placeholder" readonly></el-input>
|
||||
<div class="keybord_wrap">
|
||||
<div v-for="item in 9" :key="item">
|
||||
<el-button plain type="info" style="width: 100%" @click="inputHandle(item)">{{ item }}</el-button>
|
||||
@@ -24,11 +24,16 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: [String, Number],
|
||||
default: 1, // 1取餐号 2密码
|
||||
},
|
||||
inputType: {
|
||||
type: String,
|
||||
default: "text",
|
||||
default: 'text'
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
@@ -66,8 +71,19 @@ function delHandle() {
|
||||
|
||||
// 确认
|
||||
function confirmHandle() {
|
||||
emit("success", number.value);
|
||||
dialogVisible.value = false;
|
||||
if (!number.value) return
|
||||
if (props.type == 2) {
|
||||
if (number.value.length < 6) {
|
||||
ElMessage.error('请输入正确的密码')
|
||||
return
|
||||
} else {
|
||||
emit("success", number.value);
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
} else {
|
||||
emit("success", number.value);
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
||||
Reference in New Issue
Block a user