From 5c2d9a5d8975b92efb7ee87db5585be8f60cce60 Mon Sep 17 00:00:00 2001 From: fofolee Date: Tue, 7 Jan 2025 12:08:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9C=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E4=B8=BA=E6=AF=8F=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=8C=87=E5=AE=9A=E7=89=B9=E6=9C=89=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/composer/MultiParams.vue | 14 +++++++++++++- src/components/quickcommandUI/QuickCommand.vue | 11 +++++++++++ src/js/composer/commands/dataCommands.js | 3 --- src/js/composer/commands/simulateCommands.js | 1 - 项目说明.json | 5 +++-- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/components/composer/MultiParams.vue b/src/components/composer/MultiParams.vue index b8e16b4..c0324b6 100644 --- a/src/components/composer/MultiParams.vue +++ b/src/components/composer/MultiParams.vue @@ -34,8 +34,20 @@ export default defineComponent({ localCommand() { return this.modelValue; }, + // 通用参数配置 + commonConfig() { + return this.modelValue.config || []; + }, + // 特定函数独有参数配置 + functionConfig() { + return ( + this.modelValue.functionSelector?.options.find( + (item) => item.value === this.funcName + )?.config || [] + ); + }, localConfig() { - return (this.modelValue.config || []).map((item) => { + return [...this.commonConfig, ...this.functionConfig].map((item) => { return { ...item, value: item.defaultValue, diff --git a/src/components/quickcommandUI/QuickCommand.vue b/src/components/quickcommandUI/QuickCommand.vue index b323271..1f87b03 100644 --- a/src/components/quickcommandUI/QuickCommand.vue +++ b/src/components/quickcommandUI/QuickCommand.vue @@ -176,6 +176,17 @@ export default { * * @param initItems 初始选项数组,默认为空 * @param options 选项列表配置,默认为空 + * @example + * initItems = ['1','2','3'] + * options = {placeholder: "输入进行筛选,支持拼音", optionType: "plaintext", enableSearch: true, showCancelButton: false, closeOnSelect: true} + * + * @example + * initItems = [{title: "1", description: "1"}, {title: "2", description: "2"}, {title: "3", description: "3"}] + * options = {placeholder: "输入进行筛选,支持拼音", optionType: "json", enableSearch: true, showCancelButton: false, closeOnSelect: true} + * + * @example + * initItems = ["
1
", "
2
", "
3
"] + * options = {placeholder: "输入进行筛选,支持拼音", optionType: "html", enableSearch: true, showCancelButton: false, closeOnSelect: true} */ showSelectList: (initItems, options = {}) => new Promise((reslove, reject) => { diff --git a/src/js/composer/commands/dataCommands.js b/src/js/composer/commands/dataCommands.js index 021460f..41f72f0 100644 --- a/src/js/composer/commands/dataCommands.js +++ b/src/js/composer/commands/dataCommands.js @@ -18,7 +18,6 @@ export const dataCommands = { }, ], functionSelector: { - selectLabel: "编解码方式", options: [ { label: "Base64编码", @@ -92,7 +91,6 @@ export const dataCommands = { }, ], functionSelector: { - selectLabel: "哈希算法", options: [ { label: "MD5", @@ -137,7 +135,6 @@ export const dataCommands = { }, ], functionSelector: { - selectLabel: "计算方式", options: [ { label: "正弦(sin)", diff --git a/src/js/composer/commands/simulateCommands.js b/src/js/composer/commands/simulateCommands.js index 32b3ec9..f793065 100644 --- a/src/js/composer/commands/simulateCommands.js +++ b/src/js/composer/commands/simulateCommands.js @@ -28,7 +28,6 @@ export const simulateCommands = { }, ], functionSelector: { - selectLabel: "鼠标动作", options: [ { label: "单击", diff --git a/项目说明.json b/项目说明.json index ac6b587..a3daf46 100644 --- a/项目说明.json +++ b/项目说明.json @@ -29,12 +29,13 @@ }, "functionSelector": { "描述": "可选,函数选择器,用于选择函数,如果存在则使用MultiParams组件,用于一类参数类似,但函数名不同的命令", - "selectLabel": "必选,选择器的标签", "options": { "描述": "必选,选项,一个数组,每个元素是一个对象,包含以下属性:", "配置项属性": { "label": "必选,显示的名称", - "value": "必选,生成代码时使用的函数名" + "value": "必选,生成代码时使用的函数名", + "icon": "可选,图标", + "config": "可选,特定函数独有参数配置,和MultiParams组件的config一样" } }, "value": "必选,默认值"