button.js
5 years ago
collapse.js
5 years ago
component-wrapper.js
5 years ago
list-table-heading.js
5 years ago
list-table-item.js
5 years ago
list-table.js
5 years ago
notice-component.js
5 years ago
notice.js
5 years ago
pagination.js
5 years ago
popup.js
5 years ago
repeater-item.js
5 years ago
repeater.js
5 years ago
tabs-panel.js
5 years ago
tabs.js
5 years ago
title.js
5 years ago
popup.js
78 lines
| 1 | const Popup = { |
| 2 | name: 'cx-vui-popup', |
| 3 | template: '#cx-vui-popup', |
| 4 | props: { |
| 5 | value: { |
| 6 | type: Boolean, |
| 7 | default: false, |
| 8 | }, |
| 9 | overlay: { |
| 10 | type: Boolean, |
| 11 | default: true, |
| 12 | }, |
| 13 | close: { |
| 14 | type: Boolean, |
| 15 | default: true, |
| 16 | }, |
| 17 | showOk: { |
| 18 | type: Boolean, |
| 19 | default: true, |
| 20 | }, |
| 21 | showCancel: { |
| 22 | type: Boolean, |
| 23 | default: true, |
| 24 | }, |
| 25 | header: { |
| 26 | type: Boolean, |
| 27 | default: true, |
| 28 | }, |
| 29 | footer: { |
| 30 | type: Boolean, |
| 31 | default: true, |
| 32 | }, |
| 33 | okLabel: { |
| 34 | type: String, |
| 35 | default: 'OK', |
| 36 | }, |
| 37 | cancelLabel: { |
| 38 | type: String, |
| 39 | default: 'Cancel', |
| 40 | }, |
| 41 | bodyWidth: { |
| 42 | type: String, |
| 43 | default: 'auto', |
| 44 | }, |
| 45 | }, |
| 46 | data() { |
| 47 | return { |
| 48 | currentValue: this.value, |
| 49 | }; |
| 50 | }, |
| 51 | watch: { |
| 52 | value( val ) { |
| 53 | this.setCurrentValue( val ); |
| 54 | } |
| 55 | }, |
| 56 | methods: { |
| 57 | handleCancel() { |
| 58 | this.setCurrentValue( false ); |
| 59 | this.$emit( 'input', false ); |
| 60 | this.$emit( 'on-cancel' ); |
| 61 | }, |
| 62 | handleOk() { |
| 63 | this.setCurrentValue( false ); |
| 64 | this.$emit( 'input', false ); |
| 65 | this.$emit( 'on-ok' ); |
| 66 | }, |
| 67 | setCurrentValue( value ) { |
| 68 | |
| 69 | if ( this.currentValue === value ) { |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | this.currentValue = value; |
| 74 | }, |
| 75 | }, |
| 76 | }; |
| 77 | |
| 78 | export default Popup; |