42 lines
732 B
Vue
42 lines
732 B
Vue
<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> |