diff --git a/src/components/quickcommandUI/SelectList.vue b/src/components/quickcommandUI/SelectList.vue
new file mode 100644
index 0000000..d7d357e
--- /dev/null
+++ b/src/components/quickcommandUI/SelectList.vue
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+ {{ item }}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/js/quickcommand.js b/src/js/quickcommand.js
index a4f3e79..4385966 100644
--- a/src/js/quickcommand.js
+++ b/src/js/quickcommand.js
@@ -10,63 +10,58 @@ import {
import inputBox from "../components/quickcommandUI/InputBox"
import buttonBox from "../components/quickcommandUI/ButtonBox"
import TextArea from "../components/quickcommandUI/TextArea"
+import SelectList from "../components/quickcommandUI/SelectList"
const quickcommand = {
- showInputBox: (options = ["请输入"], title = "") => {
- return new Promise((reslove, reject) => {
- let props = {
- labels: [],
- values: [],
- hints: [],
- title: title
- }
- if (!(options instanceof Object)) return reject(new TypeError("必须为数组或对象"))
- if (options instanceof Array) props.labels = options
- else Object.assign(props, options)
- Dialog.create({
- component: inputBox,
- componentProps: props
- }).onOk(results => {
- reslove(Array.from(results))
- }).onCancel(() => {
- console.log('取消')
- })
+ showInputBox: (options = ["请输入"], title = "") => new Promise((reslove, reject) => {
+ let props = {
+ labels: [],
+ values: [],
+ hints: [],
+ title: title
+ }
+ if (!(options instanceof Object)) return reject(new TypeError("必须为数组或对象"))
+ if (options instanceof Array) props.labels = options
+ else Object.assign(props, options)
+ Dialog.create({
+ component: inputBox,
+ componentProps: props
+ }).onOk(results => {
+ reslove(Array.from(results))
+ }).onCancel(() => {
+ console.log('取消')
})
- },
+ }),
- showButtonBox: (labels = ["确定"], title = "") => {
- return new Promise((reslove, reject) => {
- if (!(labels instanceof Array)) return reject(new TypeError("必须为数组"))
- let props = {
- labels: labels,
- title: title
- }
- Dialog.create({
- component: buttonBox,
- componentProps: props
- }).onOk(results => {
- reslove(results)
- }).onCancel(() => {
- console.log('取消')
- })
+ showButtonBox: (labels = ["确定"], title = "") => new Promise((reslove, reject) => {
+ if (!(labels instanceof Array)) return reject(new TypeError("必须为数组"))
+ let props = {
+ labels: labels,
+ title: title
+ }
+ Dialog.create({
+ component: buttonBox,
+ componentProps: props
+ }).onOk(results => {
+ reslove(results)
+ }).onCancel(() => {
+ console.log('取消')
})
- },
+ }),
- showConfirmBox: (message = "", title = "提示") => {
- return new Promise((reslove, reject) => {
- Dialog.create({
- title: title,
- message: message,
- cancel: true,
- persistent: true
- }).onOk(() => {
- reslove(true)
- }).onCancel(() => {
- reslove(false)
- })
+ showConfirmBox: (message = "", title = "提示") => new Promise((reslove, reject) => {
+ Dialog.create({
+ title: title,
+ message: message,
+ cancel: true,
+ persistent: true
+ }).onOk(() => {
+ reslove(true)
+ }).onCancel(() => {
+ reslove(false)
})
- },
+ }),
showMessageBox: (message, icon = 'success', time = 3000) => {
if (icon === 'success') icon = 'positive'
@@ -79,22 +74,39 @@ const quickcommand = {
})
},
- showTextArea: (placeholder = "", value = "") => {
- return new Promise((reslove, reject) => {
- let props = {
- placeholder: placeholder,
- value: value
- }
- Dialog.create({
- component: TextArea,
- componentProps: props
- }).onOk(results => {
- reslove(results)
- }).onCancel(() => {
- console.log('取消')
- })
+ showTextArea: (placeholder = "", value = "") => new Promise((reslove, reject) => {
+ let props = {
+ placeholder: placeholder,
+ value: value
+ }
+ Dialog.create({
+ component: TextArea,
+ componentProps: props
+ }).onOk(results => {
+ reslove(results)
+ }).onCancel(() => {
+ console.log('取消')
})
- }
+ }),
+
+
+ showSelectList: (selects, options = {
+ placeholder: "请选择",
+ optionType: "plaintext"
+ }) => new Promise((reslove, reject) => {
+ let props = {
+ items: selects,
+ options: options
+ }
+ Dialog.create({
+ component: SelectList,
+ componentProps: props
+ }).onOk(results => {
+ reslove(results)
+ }).onCancel(() => {
+ console.log('取消')
+ })
+ })
}
-export default quickcommand
+export default quickcommand
\ No newline at end of file