您的位置:首页 > 教育 > 培训 > input输入框的前缀和后缀

input输入框的前缀和后缀

2024/10/6 4:06:15 来源:https://blog.csdn.net/qq_37703224/article/details/139753916  浏览:    关键词:input输入框的前缀和后缀

案例:前缀插槽

核心:

<template #prefix><user-outlined />
</template>
<script setup>
import {ref, watch} from "vue";
import {UserOutlined} from "@ant-design/icons-vue";const value = ref("")watch(value, () => {console.log("value变化了:", value.value)
})</script>
<template><div class="p-8 bg-indigo-50 text-center"><a-input placeholder="基本用法" v-model:value="value" autofocus><template #prefix><UserOutlined/></template></a-input></div>
</template>

案例:后缀插槽

核心:

<template #suffix><a-tooltip title="Extra information"><info-circle-outlined style="color: rgba(0, 0, 0, 0.45)" /></a-tooltip>
</template>
<script setup>
import {ref, watch} from "vue";
import {UserOutlined, InfoCircleOutlined} from "@ant-design/icons-vue";const value = ref("")watch(value, () => {console.log("value变化了:", value.value)
})</script>
<template><div class="p-8 bg-indigo-50 text-center"><a-input placeholder="基本用法" v-model:value="value" autofocus><template #suffix><InfoCircleOutlined class="text-red-500"/></template></a-input></div>
</template>

案例:前缀后缀属性

核心:

prefix="¥" suffix="RMB"
<script setup>
import {ref, watch} from "vue";
import {UserOutlined, InfoCircleOutlined} from "@ant-design/icons-vue";const value = ref("")watch(value, () => {console.log("value变化了:", value.value)
})</script>
<template><div class="p-8 bg-indigo-50 text-center"><a-input placeholder="基本用法"v-model:value="value"autofocusprefix="¥"suffix="RMB"/></div>
</template>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com