From 631188eedfbd1186c74e536c057bbff49b32bd72 Mon Sep 17 00:00:00 2001 From: "3075067877@qq.com" <3075067877@qq.com> Date: Mon, 29 Jan 2024 16:33:53 +0800 Subject: [PATCH] add phone input component --- .../src/components/index/keyboard/input_box_QR.vue | 18 +- .../index/keyboard/input_box_end_phone.vue | 237 +++++++++++++++++++++ .../components/index/keyboard/view_keyboard.vue | 13 +- uniapp_project_code/src/pages/index/index.nvue | 42 ++-- 4 files changed, 282 insertions(+), 28 deletions(-) create mode 100644 uniapp_project_code/src/components/index/keyboard/input_box_end_phone.vue diff --git a/uniapp_project_code/src/components/index/keyboard/input_box_QR.vue b/uniapp_project_code/src/components/index/keyboard/input_box_QR.vue index 5b9542e..d8ea8e1 100644 --- a/uniapp_project_code/src/components/index/keyboard/input_box_QR.vue +++ b/uniapp_project_code/src/components/index/keyboard/input_box_QR.vue @@ -2,7 +2,7 @@ - 输入条形码 @@ -11,7 +11,7 @@ - + 确定 @@ -29,12 +29,12 @@ ref } from 'vue' - //触发自定义事件 - const emits = defineEmits(['showIt']) + //define emits or props + const emits = defineEmits(['showIt','clickCommit']) const props = defineProps({ maskHeight: { type: Number, - default: 200 + default: 1200 }, maxInput: { type: Number, @@ -43,7 +43,6 @@ }) let inputValue = ref("") // - let activeValue = ref("") // onMounted(async (res) => { console.log(res + ` the keyboard_box component is now mounted. ` + props.maskHeight) @@ -52,6 +51,9 @@ const handle_closeKeyboardBox = () => { emits("showIt", "false") } + const handle_clickCommit = () => { + emits("clickCommit", inputValue.value) + } const accept_inputValueUpdate = (i) => { console.log("accept_inputValueClick:", i) inputValue.value = i @@ -88,7 +90,7 @@ .kb-area { width: 533.33rpx; - height: 807.64rpx; + // height: 807.64rpx; background: #fff; border-radius: 13.89rpx; @include ctf(flex-start); @@ -151,7 +153,7 @@ @include ctf(center); .txt { - font-weight: 500; + font-weight: 800; font-size: 25rpx; color: #FFFFFF; } diff --git a/uniapp_project_code/src/components/index/keyboard/input_box_end_phone.vue b/uniapp_project_code/src/components/index/keyboard/input_box_end_phone.vue new file mode 100644 index 0000000..ff8bd7d --- /dev/null +++ b/uniapp_project_code/src/components/index/keyboard/input_box_end_phone.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/uniapp_project_code/src/components/index/keyboard/view_keyboard.vue b/uniapp_project_code/src/components/index/keyboard/view_keyboard.vue index 949f6f0..29a1fad 100644 --- a/uniapp_project_code/src/components/index/keyboard/view_keyboard.vue +++ b/uniapp_project_code/src/components/index/keyboard/view_keyboard.vue @@ -16,21 +16,18 @@ ref } from 'vue' - //触发自定义事件 + //define emits or props const emits = defineEmits(['inputValueUpdate']) const props = defineProps({ maxInput: { type: Number, default: 11 }, - // inputValue : { - // type: Number, - // default: 11 - // }, + }) - let inputValue = ref("") // - let activeValue = ref("") // + let inputValue = ref("") //input value + let activeValue = ref("") //active btn value onMounted(async (res) => { console.log(res + ` the keyboard_box component is now mounted. ` + props.maskHeight) @@ -62,7 +59,7 @@ } else { //limit maxInput if (inputValue.value.length >= props.maxInput) { - return util.showNone(`最大输入${props.maxInput}位`) + return util.showNone(`最多输入${props.maxInput}位`) } inputValue.value += getNumClick(i) } diff --git a/uniapp_project_code/src/pages/index/index.nvue b/uniapp_project_code/src/pages/index/index.nvue index a8e1536..2b84301 100644 --- a/uniapp_project_code/src/pages/index/index.nvue +++ b/uniapp_project_code/src/pages/index/index.nvue @@ -14,24 +14,30 @@ - + + + + +