Initial project structure with sails.js
This commit is contained in:
59
assets/js/pages/dashboard/welcome.page.js
Normal file
59
assets/js/pages/dashboard/welcome.page.js
Normal file
@ -0,0 +1,59 @@
|
||||
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 = '';
|
||||
// ```
|
||||
},
|
||||
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user