60 lines
2.0 KiB
JavaScript
60 lines
2.0 KiB
JavaScript
|
parasails.registerPage('welcome', {
|
||
|
// ╦╔╗╔╦╔╦╗╦╔═╗╦ ╔═╗╔╦╗╔═╗╔╦╗╔═╗
|
||
|
// ║║║║║ ║ ║╠═╣║ ╚═╗ ║ ╠═╣ ║ ║╣
|
||
|
// ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝ ╚═╝ ╩ ╩ ╩ ╩ ╚═╝
|
||
|
data: {
|
||
|
modal: '',
|
||
|
pageLoadedAt: Date.now()
|
||
|
},
|
||
|
|
||
|
// ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗
|
||
|
// ║ ║╠╣ ║╣ ║ ╚╦╝║ ║ ║╣
|
||
|
// ╩═╝╩╚ ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
|
||
|
beforeMount: function() {
|
||
|
//…
|
||
|
},
|
||
|
mounted: async function() {
|
||
|
//…
|
||
|
},
|
||
|
|
||
|
// ╦ ╦╦╦═╗╔╦╗╦ ╦╔═╗╦ ╔═╗╔═╗╔═╗╔═╗╔═╗
|
||
|
// ╚╗╔╝║╠╦╝ ║ ║ ║╠═╣║ ╠═╝╠═╣║ ╦║╣ ╚═╗
|
||
|
// ╚╝ ╩╩╚═ ╩ ╚═╝╩ ╩╩═╝ ╩ ╩ ╩╚═╝╚═╝╚═╝
|
||
|
// Configure deep-linking (aka client-side routing)
|
||
|
virtualPagesRegExp: /^\/welcome\/?([^\/]+)?\/?/,
|
||
|
afterNavigate: async function(virtualPageSlug){
|
||
|
// `virtualPageSlug` is determined by the regular expression above, which
|
||
|
// corresponds with `:unused?` in the server-side route for this page.
|
||
|
switch (virtualPageSlug) {
|
||
|
case 'hello':
|
||
|
this.modal = 'example';
|
||
|
break;
|
||
|
default:
|
||
|
this.modal = '';
|
||
|
}
|
||
|
},
|
||
|
|
||
|
// ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
|
||
|
// ║║║║ ║ ║╣ ╠╦╝╠═╣║ ║ ║║ ║║║║╚═╗
|
||
|
// ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝
|
||
|
methods: {
|
||
|
|
||
|
clickOpenExampleModalButton: async function() {
|
||
|
this.goto('/welcome/hello');
|
||
|
// Or, without deep links, instead do:
|
||
|
// ```
|
||
|
// this.modal = 'example';
|
||
|
// ```
|
||
|
},
|
||
|
|
||
|
closeExampleModal: async function() {
|
||
|
this.goto('/welcome');
|
||
|
// Or, without deep links, instead do:
|
||
|
// ```
|
||
|
// this.modal = '';
|
||
|
// ```
|
||
|
},
|
||
|
|
||
|
}
|
||
|
});
|