新增将我的列表保存为TXT、CSV格式
This commit is contained in:
@@ -11,50 +11,50 @@ const defaultOptions = {
|
||||
confirmButtonText: '',
|
||||
}
|
||||
|
||||
const dialog = {
|
||||
install(Vue, options) {
|
||||
const dialog = function(options) {
|
||||
const { message, showCancel, cancelButtonText, confirmButtonText } =
|
||||
Object.assign({}, defaultOptions, typeof options == 'string' ? { message: options } : options || {})
|
||||
return new Promise((resolve, reject) => {
|
||||
let app = createApp(Dialog, {
|
||||
afterLeave() {
|
||||
app?.unmount()
|
||||
app = null
|
||||
},
|
||||
}).use(i18n).use(store)
|
||||
export const dialog = function(options) {
|
||||
const { message, showCancel, cancelButtonText, confirmButtonText } =
|
||||
Object.assign({}, defaultOptions, typeof options == 'string' ? { message: options } : options || {})
|
||||
return new Promise((resolve, reject) => {
|
||||
let app = createApp(Dialog, {
|
||||
afterLeave() {
|
||||
app?.unmount()
|
||||
app = null
|
||||
},
|
||||
}).use(i18n).use(store)
|
||||
|
||||
let instance = app.mount(document.createElement('div'))
|
||||
let instance = app.mount(document.createElement('div'))
|
||||
|
||||
// 属性设置
|
||||
instance.visible = true
|
||||
instance.message = message
|
||||
instance.showCancel = showCancel
|
||||
instance.cancelButtonText = cancelButtonText
|
||||
instance.confirmButtonText = confirmButtonText
|
||||
// 属性设置
|
||||
instance.visible = true
|
||||
instance.message = message
|
||||
instance.showCancel = showCancel
|
||||
instance.cancelButtonText = cancelButtonText
|
||||
instance.confirmButtonText = confirmButtonText
|
||||
|
||||
// 挂载
|
||||
document.getElementById('container').appendChild(instance.$el)
|
||||
// 挂载
|
||||
document.getElementById('container').appendChild(instance.$el)
|
||||
|
||||
instance.handleCancel = () => {
|
||||
instance.visible = false
|
||||
resolve(false)
|
||||
}
|
||||
|
||||
instance.handleComfirm = () => {
|
||||
instance.visible = false
|
||||
resolve(true)
|
||||
}
|
||||
})
|
||||
instance.handleCancel = () => {
|
||||
instance.visible = false
|
||||
resolve(false)
|
||||
}
|
||||
dialog.confirm = options => dialog(
|
||||
typeof options == 'string'
|
||||
? { message: options, showCancel: true }
|
||||
: { ...options, showCancel: true },
|
||||
)
|
||||
|
||||
instance.handleComfirm = () => {
|
||||
instance.visible = false
|
||||
resolve(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
dialog.confirm = options => dialog(
|
||||
typeof options == 'string'
|
||||
? { message: options, showCancel: true }
|
||||
: { ...options, showCancel: true },
|
||||
)
|
||||
|
||||
const dialogPlugin = {
|
||||
install(Vue, options) {
|
||||
Vue.config.globalProperties.$dialog = dialog
|
||||
},
|
||||
}
|
||||
|
||||
export default dialog
|
||||
export default dialogPlugin
|
||||
|
||||
Reference in New Issue
Block a user