Mentions 멘션
LhMentions @멘션 입력.
기본 사용법
기본 사용법
vue
<script setup lang="ts">
import { ref } from 'vue'
import { LhMentions } from '@lh-ui/vue3'
const text = ref('')
const members = [
{ label: '김민수' },
{ label: '이영희' },
{ label: '박철수' },
]
const t1 = {
placeholder: '@로 멤버 멘션',
}
</script>
<template>
<LhMentions v-model="text" :options="members" :placeholder="t1.placeholder" />
</template>vue
<script>
import { LhMentions } from '@lh-ui/vue3'
export default {
components: { LhMentions },
data() {
return {
text: '',
members: [
{ label: '김민수' },
{ label: '이영희' },
{ label: '박철수' },
],
t1: {
placeholder: '@로 멤버 멘션',
},
}
},
}
</script>
<template>
<LhMentions v-model="text" :options="members" :placeholder="t1.placeholder" />
</template>여러 줄 모드
vue
<script setup lang="ts">
import { ref } from 'vue'
import { LhMentions } from '@lh-ui/vue3'
const text2 = ref('')
const t2 = {
placeholder2: '여러 줄 @ 멘션',
}
</script>
<template>
<LhMentions v-model="text2" :options="members" multiline :placeholder="t2.placeholder2" />
</template>vue
<script>
import { LhMentions } from '@lh-ui/vue3'
export default {
components: { LhMentions },
data() {
return {
text2: '',
t2: {
placeholder2: '여러 줄 @ 멘션',
},
}
},
}
</script>
<template>
<LhMentions v-model="text2" :options="members" multiline :placeholder="t2.placeholder2" />
</template>Mentions API
속성
| 이름 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| modelValue | 텍스트 콘텐츠 | string | '' |
| options | 멤버 옵션 | LhMentionOption[] | [] |
| prefix | 트리거 문자 | string | '@' |
| placeholder | 플레이스홀더 | string | '' |
| disabled | 비활성화 | boolean | false |
| multiline | 여러 줄 모드 | boolean | false |
| ariaLabel | 접근성 이름 | string | — |
| sx | 빠른 레이아웃 | LhSxProps | — |
이벤트
| 이름 | 설명 | 타입 |
|---|---|---|
| update:modelValue | 텍스트 변경 시 발생 | (value: string) |
| change | 텍스트 변경 시 발생 | (value: string) |
| select | 멘션 선택 시 발생 | (option: LhMentionOption) |
슬롯
| 이름 | 설명 |
|---|---|
| empty | 일치 항목 없음 상태 |
접근성
- 입력은
role="combobox" - 이메일 오탐지 방지

