chore(Dialog): improve code

This commit is contained in:
chenjiahan 2020-08-31 11:53:40 +08:00
parent 44aaa47187
commit e1ac3f9a58
2 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,8 @@
// Utils
import { createNamespace, addUnit, pick } from '../utils'; import { createNamespace, addUnit, pick } from '../utils';
import { BORDER_TOP, BORDER_LEFT } from '../utils/constant'; import { BORDER_TOP, BORDER_LEFT } from '../utils/constant';
// Components
import Popup from '../popup'; import Popup from '../popup';
import Button from '../button'; import Button from '../button';
import ActionBar from '../action-bar'; import ActionBar from '../action-bar';
@ -19,11 +22,12 @@ export default createComponent({
lazyRender: Boolean, lazyRender: Boolean,
beforeClose: Function, beforeClose: Function,
messageAlign: String, messageAlign: String,
showCancelButton: Boolean,
cancelButtonText: String, cancelButtonText: String,
cancelButtonColor: String, cancelButtonColor: String,
confirmButtonText: String, confirmButtonText: String,
confirmButtonColor: String, confirmButtonColor: String,
showCancelButton: Boolean, closeOnClickOverlay: Boolean,
overlay: { overlay: {
type: Boolean, type: Boolean,
default: true, default: true,
@ -44,10 +48,6 @@ export default createComponent({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
closeOnClickOverlay: {
type: Boolean,
default: false,
},
}, },
emits: ['confirm', 'cancel', 'update:show'], emits: ['confirm', 'cancel', 'update:show'],
@ -204,13 +204,13 @@ export default createComponent({
return ( return (
<Popup <Popup
show={this.show}
role="dialog" role="dialog"
class={[bem([this.theme]), this.className]} class={[bem([this.theme]), this.className]}
style={{ width: addUnit(this.width) }} style={{ width: addUnit(this.width) }}
aria-labelledby={this.title || message} aria-labelledby={this.title || message}
{...{ {...{
...pick(this, [ ...pick(this, [
'show',
'overlay', 'overlay',
'transition', 'transition',
'lazyRender', 'lazyRender',

View File

@ -1,3 +1,5 @@
import { watch, onMounted, onUnmounted } from 'vue';
// Utils // Utils
import { createNamespace, isDef } from '../utils'; import { createNamespace, isDef } from '../utils';
import { lockClick } from './lock-click'; import { lockClick } from './lock-click';
@ -6,7 +8,6 @@ import { lockClick } from './lock-click';
import Icon from '../icon'; import Icon from '../icon';
import Popup from '../popup'; import Popup from '../popup';
import Loading from '../loading'; import Loading from '../loading';
import { watch, onMounted, onUnmounted } from 'vue';
const [createComponent, bem] = createNamespace('toast'); const [createComponent, bem] = createNamespace('toast');