This commit is contained in:
icssoa 2024-02-22 15:03:07 +08:00
parent 522aa17441
commit f73742a432
8 changed files with 31 additions and 9 deletions

View File

@ -9,7 +9,7 @@
"lint:eslint": "eslint \"./src/**/*.{vue,ts,tsx}\" --fix"
},
"dependencies": {
"@cool-vue/crud": "^7.1.13",
"@cool-vue/crud": "^7.1.14",
"@element-plus/icons-vue": "^2.1.0",
"@vueuse/core": "^10.4.0",
"@wangeditor/editor": "^5.1.23",

View File

@ -1,6 +1,6 @@
{
"name": "@cool-vue/crud",
"version": "7.1.13",
"version": "7.1.14",
"private": false,
"main": "./dist/index.umd.min.js",
"typings": "types/index.d.ts",

View File

@ -113,7 +113,7 @@ export default defineComponent({
// 渲染表单
function renderForm() {
return h(<cl-form ref={Form} inner />, {}, slots);
return h(<cl-form ref={Form} inner enable-plugin={false} />, {}, slots);
}
// 渲染底部

View File

@ -1,7 +1,7 @@
import { Ref, WatchStopHandle, getCurrentInstance, watch } from "vue";
import { useConfig } from "../../../hooks";
export function usePlugins({ visible }: { visible: Ref<boolean> }) {
export function usePlugins(enable: boolean, { visible }: { visible: Ref<boolean> }) {
const that: any = getCurrentInstance();
const { style } = useConfig();
@ -24,6 +24,10 @@ export function usePlugins({ visible }: { visible: Ref<boolean> }) {
// 插件创建
function create(plugins: ClForm.Plugin[] = []) {
if (!enable) {
return false;
}
for (const i in ev) {
ev[i] = [];
}

View File

@ -12,7 +12,11 @@ export default defineComponent({
props: {
inner: Boolean,
inline: Boolean
inline: Boolean,
enablePlugin: {
type: Boolean,
default: true
}
},
setup(props, { expose, slots }) {
@ -40,7 +44,7 @@ export default defineComponent({
);
// 插件
const plugin = usePlugins({ visible });
const plugin = usePlugins(props.enablePlugin, { visible });
// 显示加载中
function showLoading() {

View File

@ -139,7 +139,12 @@ export default defineComponent({
isEmpty(config.items) || (
<div class="cl-search">
{h(
<cl-form ref={Form} inner inline={config.inline} />,
<cl-form
ref={Form}
inner
inline={config.inline}
enable-plugin={false}
/>,
{},
{
append() {

View File

@ -1,8 +1,8 @@
/// <reference types="../index" />
import { Ref } from "vue";
export declare function usePlugins({ visible }: {
export declare function usePlugins(enable: boolean, { visible }: {
visible: Ref<boolean>;
}): {
create: (plugins?: ClForm.Plugin[]) => void;
create: (plugins?: ClForm.Plugin[]) => false | undefined;
submit: (data: any) => Promise<any>;
};

View File

@ -1,11 +1,20 @@
declare const _default: import("vue").DefineComponent<{
inner: BooleanConstructor;
inline: BooleanConstructor;
enablePlugin: {
type: BooleanConstructor;
default: boolean;
};
}, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
inner: BooleanConstructor;
inline: BooleanConstructor;
enablePlugin: {
type: BooleanConstructor;
default: boolean;
};
}>>, {
inline: boolean;
inner: boolean;
enablePlugin: boolean;
}, {}>;
export default _default;