mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* feat: add mention component * fix: build error * fix: build error * feat: delete as a whole * fix: update docs * fix: update global.d.ts * fix: update * fix: update code * fix: update code * fix: update code * fix: rename * fix: update code * fix: upload code * fix: update code * fix: fixed cursor position abnormality * fix: update code * fix: docs add avatar * fix: tooltip position is wrong when placing on top * feat: add overview icon * fix: overview icon color
40 lines
849 B
Vue
40 lines
849 B
Vue
<template>
|
|
<el-mention
|
|
v-model="value"
|
|
:options="options"
|
|
:loading="loading"
|
|
style="width: 320px"
|
|
placeholder="Please input"
|
|
@search="handleSearch"
|
|
/>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { onBeforeMount, ref } from 'vue'
|
|
import type { MentionOption } from 'element-plus'
|
|
|
|
const value = ref('')
|
|
const loading = ref(false)
|
|
const options = ref<MentionOption[]>([])
|
|
|
|
let timer: ReturnType<typeof setTimeout>
|
|
const handleSearch = (pattern: string) => {
|
|
if (timer) clearTimeout(timer)
|
|
|
|
loading.value = true
|
|
timer = setTimeout(() => {
|
|
options.value = ['Fuphoenixes', 'kooriookami', 'Jeremy', 'btea'].map(
|
|
(item) => ({
|
|
label: pattern + item,
|
|
value: pattern + item,
|
|
})
|
|
)
|
|
loading.value = false
|
|
}, 1500)
|
|
}
|
|
|
|
onBeforeMount(() => {
|
|
if (timer) clearTimeout(timer)
|
|
})
|
|
</script>
|