File tree Expand file tree Collapse file tree 6 files changed +46
-17
lines changed
Expand file tree Collapse file tree 6 files changed +46
-17
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,23 @@ Vue.use(Modal. {
6464### Props
6565vue-modal-2 accept some props
6666
67+ #### ` headerOptions `
68+ options props for vue-modal-2 header
69+ - type: ` Object `
70+ - default: ` {} `
71+
72+ __ headerOptions key:__
73+
74+ | key| type| default| desc|
75+ | ---| ---| ---| ---|
76+ | ` headerOptions.title ` | ` String ` | Modal title| Modal title on the left side|
77+ | ` headerOptions.closeIcon ` | ` String ` | ` ✕ ` | Close button icon on the right side|
78+
79+ #### ` footerOptions `
80+ options props for vue-modal-2 footer
81+ - type: ` Object `
82+ - default: ` {} `
83+
6784#### ` noFooter `
6885used to remove footer
6986- type: ` Boolean `
Original file line number Diff line number Diff line change 33 <img alt =" Vue logo" src =" ./assets/logo.png" width =" 25%" />
44 <p v-for =" i in 10" :key =" i" >scroll down</p >
55
6- <ContainerModal
6+ <modal-vue
77 name =" modal1"
8+ :headerOptions =" {
9+ title: 'Delete?'
10+ }"
811 :footerOptions =" {
912 btn1OnClick: () => hell(),
1013 justify: 'flex-start',
1922 <!-- <div>Footer Name</div> -->
2023 </template >
2124 <div >content</div >
22- </ContainerModal >
25+ </modal-vue >
2326 <button @click =" open" class =" button" >Click Here</button >
2427
2528 <p v-for =" i in 10" :key =" i" >scroll up</p >
2629 </div >
2730</template >
2831
2932<script >
30- import ContainerModal from " ./components/Container" ;
33+ // import ContainerModal from "./components/Container";
3134export default {
3235 name: " App" ,
3336 components: {
34- ContainerModal,
37+ // ContainerModal,
3538 },
3639 data () {
3740 return {
Original file line number Diff line number Diff line change 1212 id =" vm2_box"
1313 :style =" { backgroundColor: modalBgColor, color: fontColor }"
1414 >
15- <withHeader v-if =" !noHeader" @on-icon-click =" handleClose" >
15+ <withHeader v-if =" !noHeader" @on-icon-click =" handleClose" :props = " {...headerOptions} " >
1616 <slot name =" header" />
1717 </withHeader >
1818 <div v-if =" hasDefaultSlot" style =" margin : 15px " >This is content</div >
@@ -38,6 +38,10 @@ export default {
3838 type: Object ,
3939 default : () => {},
4040 },
41+ headerOptions: {
42+ type: Object ,
43+ default : () => {},
44+ },
4145 // visible: {
4246 // type: Boolean,
4347 // default: false,
Original file line number Diff line number Diff line change 1313
1414<script >
1515export default {
16- props: {
17- title: {
18- type: String ,
19- default: " Modal title" ,
20- },
21- closeIcon: {
22- type: String ,
23- default: " ✕" ,
24- },
25- },
16+ props: [' props' ],
2617 methods: {
2718 handleIconClick () {
2819 this .$emit (" on-icon-click" );
@@ -32,6 +23,18 @@ export default {
3223 hasDefaultSlot () {
3324 return ! this .$slots .default ;
3425 },
26+ title () {
27+ if (this .props && this .props .title ) {
28+ return this .props .title ;
29+ }
30+ return " Modal title" ;
31+ },
32+ closeIcon () {
33+ if (this .props && this .props .closeIcon ) {
34+ return this .props .closeIcon ;
35+ }
36+ return " ✕" ;
37+ }
3538 },
3639};
3740 </script >
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const plugin = {
1010 return ;
1111 }
1212
13- const options = Object . assign ( opts , optsDefault ) ;
13+ const options = Object . assign ( optsDefault , opts ) ;
1414
1515 const root = new Vue ( ) ;
1616
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ import App from "./App.vue";
33import VM2 from "./index.js" ;
44
55Vue . config . productionTip = false ;
6- Vue . use ( VM2 ) ;
6+ Vue . use ( VM2 , {
7+ componentName : 'ModalVue'
8+ } ) ;
79new Vue ( {
810 render : ( h ) => h ( App )
911} ) . $mount ( "#app" ) ;
You can’t perform that action at this time.
0 commit comments