1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
| import { createNamespace, isDef } from '../utils';
| import { PopupMixin } from '../mixins/popup';
| import Icon from '../icon';
|
| var _createNamespace = createNamespace('popup'),
| createComponent = _createNamespace[0],
| bem = _createNamespace[1];
|
| export default createComponent({
| mixins: [PopupMixin()],
| props: {
| round: Boolean,
| duration: [Number, String],
| closeable: Boolean,
| transition: String,
| safeAreaInsetBottom: Boolean,
| closeIcon: {
| type: String,
| default: 'cross'
| },
| closeIconPosition: {
| type: String,
| default: 'top-right'
| },
| position: {
| type: String,
| default: 'center'
| },
| overlay: {
| type: Boolean,
| default: true
| },
| closeOnClickOverlay: {
| type: Boolean,
| default: true
| }
| },
| beforeCreate: function beforeCreate() {
| var _this = this;
|
| var createEmitter = function createEmitter(eventName) {
| return function (event) {
| return _this.$emit(eventName, event);
| };
| };
|
| this.onClick = createEmitter('click');
| this.onOpened = createEmitter('opened');
| this.onClosed = createEmitter('closed');
| },
| methods: {
| onClickCloseIcon: function onClickCloseIcon(event) {
| this.$emit('click-close-icon', event);
| this.close();
| }
| },
| render: function render() {
| var _bem;
|
| var h = arguments[0];
|
| if (!this.shouldRender) {
| return;
| }
|
| var round = this.round,
| position = this.position,
| duration = this.duration;
| var isCenter = position === 'center';
| var transitionName = this.transition || (isCenter ? 'van-fade' : "van-popup-slide-" + position);
| var style = {};
|
| if (isDef(duration)) {
| var key = isCenter ? 'animationDuration' : 'transitionDuration';
| style[key] = duration + "s";
| }
|
| return h("transition", {
| "attrs": {
| "appear": this.transitionAppear,
| "name": transitionName
| },
| "on": {
| "afterEnter": this.onOpened,
| "afterLeave": this.onClosed
| }
| }, [h("div", {
| "directives": [{
| name: "show",
| value: this.value
| }],
| "style": style,
| "class": bem((_bem = {
| round: round
| }, _bem[position] = position, _bem['safe-area-inset-bottom'] = this.safeAreaInsetBottom, _bem)),
| "on": {
| "click": this.onClick
| }
| }, [this.slots(), this.closeable && h(Icon, {
| "attrs": {
| "role": "button",
| "tabindex": "0",
| "name": this.closeIcon
| },
| "class": bem('close-icon', this.closeIconPosition),
| "on": {
| "click": this.onClickCloseIcon
| }
| })])]);
| }
| });
|
|