签入版本
This commit is contained in:
@@ -17,13 +17,13 @@ import { BasicForm, useForm } from '@/components/Form';
|
||||
const [registerForm] = useForm({
|
||||
schemas: [
|
||||
{
|
||||
field: 'name',
|
||||
name: 'name',
|
||||
label: '名称',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
rules: [{ required: true, message: '请输入名称', trigger: ['blur'] }],
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
name: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
@@ -42,17 +42,21 @@ const [registerForm] = useForm({
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<BasicModal @register="registerModal" @ok="handleSubmit" />
|
||||
<basicModal @register="registerModal" @ok="handleSubmit">
|
||||
<template #default>
|
||||
<!-- 表单内容 -->
|
||||
</template>
|
||||
</basicModal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { BasicModal, useModal } from '@/components/Modal';
|
||||
import { basicModal, useModal } from '@/components/Modal';
|
||||
|
||||
const [registerModal, { openModal, closeModal }] = useModal();
|
||||
|
||||
// 打开弹窗
|
||||
const handleAdd = () => {
|
||||
openModal(true, { isUpdate: false });
|
||||
openModal();
|
||||
};
|
||||
|
||||
// 提交
|
||||
@@ -68,12 +72,11 @@ const handleSubmit = async () => {
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<BasicUpload v-model="formData.avatar" :action="uploadUrl" />
|
||||
<UploadImg v-model:image-url="formData.avatar" name="example" :fileSize="20" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { BasicUpload } from '@/components/Upload';
|
||||
const uploadUrl = '/api/upload/uploadFile';
|
||||
import UploadImg from '@/components/Upload/Image.vue';
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -81,11 +84,18 @@ const uploadUrl = '/api/upload/uploadFile';
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<Editor v-model="formData.content" />
|
||||
<Editor ref="editorRef" :height="editorHeight" name="content" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Editor from '@/components/Editor/index.vue';
|
||||
import { ref } from 'vue';
|
||||
import Editor from '@/components/Editor/tinymce.vue';
|
||||
|
||||
const editorRef = ref();
|
||||
const editorHeight = 400;
|
||||
|
||||
// 提交时读取编辑器内容(真实项目回填:editorRef.value.myValue = html)
|
||||
const getContent = () => editorRef.value?.myValue;
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -93,11 +103,13 @@ import Editor from '@/components/Editor/index.vue';
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<Password v-model="formData.password" />
|
||||
<Password :value="formData.password" :repeat="true" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Password } from '@/components/Password';
|
||||
|
||||
// 组件内部维护输入值与强度校验,仅通过 value 单向传入初始值(无 v-model)
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user