ny
23 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<script lang="ts" setup>
import type { FormSchema } from '@jnpf/ui/form';
 
import { ref } from 'vue';
 
import { BasicForm, useForm } from '@jnpf/ui/form';
import { BasicPopup, usePopupInner } from '@jnpf/ui/popup';
 
import { getInfo } from '#/api/system/cache';
 
const id = ref('');
const schemas: FormSchema[] = [
  {
    field: 'name',
    label: 'STRING',
    component: 'Input',
    componentProps: { placeholder: 'STRING', readonly: true },
  },
  {
    field: 'value',
    label: 'VALUE',
    component: 'Textarea',
    componentProps: { placeholder: 'VALUE', rows: 30, readonly: true },
  },
];
const [registerForm, { setFieldsValue, resetFields }] = useForm({ labelWidth: 50, schemas });
const [registerPopup, { changeLoading }] = usePopupInner(init);
 
function init(data) {
  resetFields();
  id.value = data.id;
  if (id.value) {
    changeLoading(true);
    getInfo(id.value).then((res) => {
      setFieldsValue(res.data);
      changeLoading(false);
    });
  }
}
</script>
<template>
  <BasicPopup v-bind="$attrs" @register="registerPopup" title="查看缓存">
    <BasicForm @register="registerForm" class="!px-[10px]" />
  </BasicPopup>
</template>