File tree Expand file tree Collapse file tree 1 file changed +21
-20
lines changed Expand file tree Collapse file tree 1 file changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -34,52 +34,52 @@ const overflowScrollReg = /scroll|auto/i;
3434const popupProps = {
3535 id: {
3636 type: String | Number ,
37- default: ' ' ,
37+ default: ' '
3838 },
3939 position: {
4040 type: String ,
41- default: ' center' ,
41+ default: ' center'
4242 },
4343
4444 transition: String ,
4545
4646 closeable: {
4747 type: Boolean ,
48- default: false ,
48+ default: false
4949 },
5050 closeIconPosition: {
5151 type: String ,
52- default: ' top-right' ,
52+ default: ' top-right'
5353 },
5454 closeIcon: {
5555 type: String ,
56- default: ' cross' ,
56+ default: ' cross'
5757 },
5858
5959 closeOnClickOverlay: {
6060 type: Boolean ,
61- default: true ,
61+ default: true
6262 },
6363
6464 destroyOnClose: {
6565 type: Boolean ,
66- default: false ,
66+ default: false
6767 },
6868 getContainer: String ,
6969 round: {
7070 type: Boolean ,
71- default: false ,
72- },
71+ default: false
72+ }
7373};
7474export default {
7575 name: ' nut-popup' ,
7676 mixins: [touchMixins],
7777 components: {
78- icon: Icon,
78+ icon: Icon
7979 },
8080 props: {
8181 ... overlayProps,
82- ... popupProps,
82+ ... popupProps
8383 },
8484 created () {
8585 this .transition ? (this .transitionName = this .transition ) : (this .transitionName = ` popup-slide-${ this .position } ` );
@@ -88,6 +88,7 @@ export default {
8888 if (this .value ) {
8989 this .open ();
9090 }
91+ this .portal ();
9192 },
9293 beforeDestroy () {
9394 if (this .value ) {
@@ -115,19 +116,19 @@ export default {
115116 val === ' center' ? (this .transitionName = ' popup-fade' ) : (this .transitionName = ` popup-slide-${ this .position } ` );
116117 },
117118 getContainer: ' portal' ,
118- overlay: ' renderOverlay' ,
119+ overlay: ' renderOverlay'
119120 },
120121 data () {
121122 return {
122123 showSlot: true ,
123124 transitionName: ' popup-fade-center' ,
124- overlayInstant: null ,
125+ overlayInstant: null
125126 };
126127 },
127128 computed: {
128129 transitionDuration () {
129130 return this .duration ? this .duration + ' s' : ' initial' ;
130- },
131+ }
131132 },
132133
133134 methods: {
@@ -149,7 +150,7 @@ export default {
149150 overlayClass,
150151 overlayStyle,
151152 lockScroll,
152- closeOnClickOverlay,
153+ closeOnClickOverlay
153154 };
154155
155156 this .renderOverlay (config);
@@ -229,20 +230,20 @@ export default {
229230 },
230231 portal () {
231232 const { getContainer } = this ;
232- const el = this .$el ;
233233
234+ const el = this .$el ;
234235 let container;
235236 if (getContainer) {
236237 container = this .getElement (getContainer);
237- } else if ( this . $parent ) {
238- container = this . $parent . $el ;
238+ } else {
239+ return ;
239240 }
240241
241242 if (container && container !== el .parentNode ) {
242243 container .appendChild (el);
243244 }
244- },
245- },
245+ }
246+ }
246247};
247248export { popupProps };
248249 </script >
You can’t perform that action at this time.
0 commit comments