1.0.5 • Published 8 years ago
vigour-modal v1.0.5
Easily create modals for use with vigour-element
##how to use
npm i --save vigour-modal
##setup
// define some data
var Observable = require('vigour-observable')
var Data = new Observable({
inject: require('vigour-observable/lib/data'),
Child: 'Constructor'
}).Constructor
// define some modals
var modalData = new Data({
firstModal: {
title:'one modal',
buttons: {
goToOtherModal: ['$', 'modals', 'secondModal'] // reference to secondModal field
}
},
secondModal: {
title:'another modal',
buttons: {
goToOtherModal: ['$', 'modals', 'firstModal'] // reference to firstModal field
}
}
})
// define your navigation data
var navigation = new Data({
state:{
modal:{
// this is the field your modals will set when navigating
current: modalData.firstModal
}
}
})
// add modal component to your app
var app = e({
components: {
modal: require('vigour-modal')
},
DOM: document.body
})
// add your modal switcher
app.set({
myModalSwitcher: {
type:'modal'
}
})
// add your data
app.val = navigation