Hello,
I am using vanilla JS with F7
I want to load some components after the page loads, as in this picture:
I want to do it through router component, but I don’t seem to find the way.
Hello,
I am using vanilla JS with F7
I want to load some components after the page loads, as in this picture:
there is a function beforePageInit, and u can render everything
Thanks for your answer. I need to load components through the router, if that makes sense.
Yeah, I read it. This is my current code:
routes: [ …
{
path: ‘/’,
url: ‘/ajax_loading.php?link1=home’,
on: {
pageInit: function (event, page) {
loadPosts();
},
},
},
And this is my loadPosts():
function loadPosts() {
Framework7.request.get(Ajax_Requests_File(), { f: ‘load_posts’ })
.then(function (res) {
$(’.post_container’).html(res.data);
console.log(res.data)
})
.catch(function (err) {
console.log(err.xhr)
console.log(err.status)
console.log(err.message)
})
}
What I want to do is to load posts via ther router component after the home page loads. to be able to execute the js code inside the posts.
see, i think you should execute the query inside the page, not inside the routes.
on query to execute inside the page, you can pass the params the router has.
Show me your page screenshot then i can help you.