index.vue
987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-13 18:13:21
* @FilePath: /data-table/src/components/TextField/index.vue
* @Description: 单行文本输入框
-->
<template>
<div class="text-field-page">
<div class="label">{{ item.label }}<span v-if="item.required"> *</span></div>
<van-field v-model="item.value"
:name="item.name" :type="item.type" :placeholder="item.placeholder"
:rules="item.rules" :required="item.required"
:readonly="item.component_props.readonly" :disabled="item.component_props.disabled"
:input-align="item.component_props.align"
clearable :border="false" />
</div>
</template>
<script setup>
const props = defineProps({
item: Object
})
</script>
<style lang="less" scoped>
.text-field-page {
.label {
padding: 1rem 1rem 0 1rem;
font-size: 0.9rem;
font-weight: bold;
span {
color: red;
}
}
}
</style>