Reputation: 3466
I am kind of new on Vue. I am working on a Vue.js 2.x app where I have the usual Vue Instance with all the methods, data and other properties.
For instance, I have the in the data the following properties:
data: {
users: []
}
In the /admin
page I use Vue to load only five users with a method loadUsers(5)
. Where in the created hook I call this.users = this.loadUsers(5);
.
But in the /users
page I load all the users within the same users variable. Right?
I am using a PHP framework's router, not Vue Router.
How should I separate different data for different pages?
Upvotes: 1
Views: 69
Reputation:
You could create separate Components per page. They come in several different varieties, Single File, Local, and inline.
I frequently opt for single file myself. I like the separation and organization they come with. As you get further along look into Dynamic. These are good swapping in and out a section of the page, but you're not limited by means.
Upvotes: 3