first
This commit is contained in:
42
components/JeepayFormItemInput/JeepayFormItemInput.vue
Normal file
42
components/JeepayFormItemInput/JeepayFormItemInput.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<uni-easyinput
|
||||
v-model="props.value" :type="props.type"
|
||||
:placeholder="vdata.errorMsg || props.placeholder"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted, onUnmounted, provide, computed, inject, watch } from 'vue'
|
||||
|
||||
const jeepayFormItemErrorMsgInject = inject("jeepayFormItemErrorMsg")
|
||||
|
||||
|
||||
// 定义组件参数
|
||||
const props = defineProps({
|
||||
|
||||
placeholder: { type: String },
|
||||
|
||||
label: { type: String },
|
||||
|
||||
type: { type: String },
|
||||
|
||||
// 双向绑定
|
||||
value: { type: [String, Number] }
|
||||
|
||||
})
|
||||
|
||||
const vdata = reactive({
|
||||
|
||||
errorMsg: null, // 错误提示信息
|
||||
|
||||
})
|
||||
|
||||
watch(() => jeepayFormItemErrorMsgInject.value, (newVal, oldVal) => {
|
||||
vdata.errorMsg = newVal
|
||||
}
|
||||
)
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user