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" - メールアドレスの誤検出を防止

