mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-09 06:54:11 +08:00
支持在配置文件中为每一个函数指定特有参数
This commit is contained in:
parent
1c35b6fdd8
commit
5c2d9a5d89
@ -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,
|
||||
|
@ -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 = ["<div>1</div>", "<div>2</div>", "<div>3</div>"]
|
||||
* options = {placeholder: "输入进行筛选,支持拼音", optionType: "html", enableSearch: true, showCancelButton: false, closeOnSelect: true}
|
||||
*/
|
||||
showSelectList: (initItems, options = {}) =>
|
||||
new Promise((reslove, reject) => {
|
||||
|
@ -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)",
|
||||
|
@ -28,7 +28,6 @@ export const simulateCommands = {
|
||||
},
|
||||
],
|
||||
functionSelector: {
|
||||
selectLabel: "鼠标动作",
|
||||
options: [
|
||||
{
|
||||
label: "单击",
|
||||
|
@ -29,12 +29,13 @@
|
||||
},
|
||||
"functionSelector": {
|
||||
"描述": "可选,函数选择器,用于选择函数,如果存在则使用MultiParams组件,用于一类参数类似,但函数名不同的命令",
|
||||
"selectLabel": "必选,选择器的标签",
|
||||
"options": {
|
||||
"描述": "必选,选项,一个数组,每个元素是一个对象,包含以下属性:",
|
||||
"配置项属性": {
|
||||
"label": "必选,显示的名称",
|
||||
"value": "必选,生成代码时使用的函数名"
|
||||
"value": "必选,生成代码时使用的函数名",
|
||||
"icon": "可选,图标",
|
||||
"config": "可选,特定函数独有参数配置,和MultiParams组件的config一样"
|
||||
}
|
||||
},
|
||||
"value": "必选,默认值"
|
||||
|
Loading…
x
Reference in New Issue
Block a user