perf: dynamic options demo

This commit is contained in:
ckl1
2022-07-01 09:46:38 +08:00
parent 5e292f8a2b
commit 9a3b6177aa
4 changed files with 18 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import { Search } from '@/components/Search'
import { reactive, ref, unref } from 'vue'
import { useValidator } from '@/hooks/web/useValidator'
import { ElButton } from 'element-plus'
import { getDictOneApi } from '@/api/common'
const { required } = useValidator()
@@ -174,6 +175,14 @@ const changePosition = (position: string) => {
layout.value = 'bottom'
buttomPosition.value = position
}
const getDictOne = async () => {
const res = await getDictOneApi()
if (res) {
schema[1].componentProps!.options = res.data
console.log(res.data)
}
}
</script>
<template>
@@ -196,6 +205,9 @@ const changePosition = (position: string) => {
<ElButton @click="changePosition('right')">
{{ t('searchDemo.bottom') }} {{ t('searchDemo.position') }}-{{ t('searchDemo.right') }}
</ElButton>
<ElButton @click="getDictOne">
{{ t('searchDemo.dynamicOptions') }}
</ElButton>
</ContentWrap>
<ContentWrap :title="t('searchDemo.search')" :message="t('searchDemo.searchDes')">