新增根据歌曲名、歌手名等字段对列表自动排序的功能
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<Modal :show="visible" @close="handleCancel" @after-leave="afterLeave" :closeBtn="false">
|
||||
<main :class="$style.main">{{message}}</main>
|
||||
<footer :class="$style.footer">
|
||||
<Btn :class="$style.btn" v-if="showCancel" @click="handleCancel">{{cancelBtnText}}</Btn>
|
||||
<Btn :class="$style.btn" @click="handleComfirm">{{confirmBtnText}}</Btn>
|
||||
</footer>
|
||||
</Modal>
|
||||
<Modal :show="visible" @close="handleCancel" @after-leave="afterLeave" :closeBtn="false" :teleport="teleport">
|
||||
<main :class="$style.main">{{message}}</main>
|
||||
<footer :class="$style.footer">
|
||||
<Btn :class="$style.btn" v-if="showCancel" @click="handleCancel">{{cancelBtnText}}</Btn>
|
||||
<Btn :class="$style.btn" @click="handleComfirm">{{confirmBtnText}}</Btn>
|
||||
</footer>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -29,6 +29,7 @@ export default {
|
||||
showCancel: false,
|
||||
cancelButtonText: '',
|
||||
confirmButtonText: '',
|
||||
teleport: '#root',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -6,13 +6,14 @@ import { createApp } from 'vue'
|
||||
|
||||
const defaultOptions = {
|
||||
message: '',
|
||||
teleport: '#root',
|
||||
showCancel: false,
|
||||
cancelButtonText: '',
|
||||
confirmButtonText: '',
|
||||
}
|
||||
|
||||
export const dialog = function(options) {
|
||||
const { message, showCancel, cancelButtonText, confirmButtonText } =
|
||||
const { message, showCancel, cancelButtonText, confirmButtonText, teleport } =
|
||||
Object.assign({}, defaultOptions, typeof options == 'string' ? { message: options } : options || {})
|
||||
return new Promise((resolve, reject) => {
|
||||
let app = createApp(Dialog, {
|
||||
@@ -30,6 +31,7 @@ export const dialog = function(options) {
|
||||
instance.showCancel = showCancel
|
||||
instance.cancelButtonText = cancelButtonText
|
||||
instance.confirmButtonText = confirmButtonText
|
||||
instance.teleport = teleport
|
||||
|
||||
// 挂载
|
||||
document.getElementById('container').appendChild(instance.$el)
|
||||
@@ -45,6 +47,7 @@ export const dialog = function(options) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
dialog.confirm = options => dialog(
|
||||
typeof options == 'string'
|
||||
? { message: options, showCancel: true }
|
||||
|
||||
Reference in New Issue
Block a user