hi everyone, I would like to take the id parameter so I can use it for a query. How can I do?
I pass it like this: <a href="/menu-single/1/"><h4>Fresh Grilled Salmon</h4></a>
and my routes.js: path: '/menu-single/:id/', url: './menu-single.php',
1 Like
in router component: this.$route.params.id
1 Like
when i enter in my menu-single page how i can set the id value to a php variable?
please, unfortunately I don’t know how the router component
this is how i solved it:
the link is:
/blog/11-2-2018/
the route is:
{
path: ‘/blog/:date’,
templateUrl: ‘./pages/blog.php?date={{this.$route.params.date}}’,
},
and print_r($_GET) in blog.php prints out:
Array ( [date] => 11-2-2018 )
2 Likes
//save array
SaveData: function(key, value)
{
var storage = localStorage;
storage.setItem(key, value);
},
GetUserParam: function(param)
{
var app = this.$app;
//console.log("userObj: "+app.methods.LoadData("userObj"));
if(!app.methods.LoadData("userObj"))
{
return 0;
}
else
{
//convert array to jason
var array = JSON.parse(app.methods.LoadData(“userObj”));
return array[param];
}
},
//use
app.methods.GetUserParam(‘id’);
//output
id = 1