index.vue 837 Bytes
<!--
 * @Date: 2022-08-29 14:31:20
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2022-09-07 16:01:42
 * @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">&nbsp;*</span></div>
    <van-field v-model="item.value" :name="item.name" :type="item.type" :placeholder="item.placeholder"
      :rules="item.rules" :required="item.required" 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>