in Education by
Tell me how to make it so that when you click on a button from a cycle with page numbers, this particular page opens. Switching along the arrows works for me, but I cannot understand how to switch between pages. I take data from Api. Total posts 98. It is possible to add your posts. On one page only 10 posts are shown. My html:
Add a post
Your Posts
  • Title: {{ post.title }}

    Content: {{ post.body }}

My js: export default { el: "#app", data () { return { current: null, page: 0, posts: [], createTitle: '', createBody: '', visiblePostID: '', } }, watch: { counter: function(newValue, oldValue) { this.getData() } }, created(){ this.getData() }, computed: { evenPosts: function(posts){ return Math.ceil(this.posts.length/10); }, paginatedData() { const start = this.page * 10; const end = start + 10; return this.posts.slice(start, end); } }, methods: { setCurrent: function(id) { this.current = id; }, getData() { axios.get(`https://jsonplaceholder.typicode.com/posts`).then(response => { this.posts = response.data }) }, deleteData(index, id) { axios.delete('http://jsonplaceholder.typicode.com/posts/' + id) .then(response => { console.log('delete') this.posts.splice(index, 1); }) .catch(function(error) { console.log(error) }) }, addPost() { axios.post('http://jsonplaceholder.typicode.com/posts/', { title: this.createTitle, body: this.createBody }).then((response) => { this.posts.unshift(response.data) }) }, changePost(id, title, body) { axios.put('http://jsonplaceholder.typicode.com/posts/' + id, { title: title, body: body }) }, } } Screenshot of application JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
add click event @click="page=n" in button Codepen : https://codepen.io/anon/pen/bZOROO

Related questions

0 votes
    I am developing a single-page-application using vue-cli3 and npm. The problem: Populating a basic integer ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am developing a single-page-application using vue-cli3 and npm. The problem: Populating a basic integer ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I'm trying to get a modal to pop up on cellClick. I'm not getting any errors, but it's not ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I have two functions in my store, one that gets data by calling API and one that toggles change ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    I have set up Vue so that I have a top level AppLayout component which just includes a Navigation Menu ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    recently I started to work on Vue js and I want to use a javascript plugin like Isotope also I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    Basically I need to add the script to the head of my index.html, so what I've tried is... in ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    Basically I need to add the script to the head of my index.html, so what I've tried is... in ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 10, 2022 in Education by JackTerrance
0 votes
    I'm used to v3 node botbuilder sdk so I have a middleware where I look at the dialog stack and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    The napi_create_date function appeared in Node.js starting with 11.11.0 version. https://nodejs.org/api/n- ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    app.route('/users') .post(user.post) .get(user.get) .get(user.everyone) .put(user.update) . ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I am trying to write some stuff in a file using reactJS and nodeJs but it doesnt work. Here is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am trying to create a simple node.js app on heroku. Here is app.js: console.log("Starting App" ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    *Updated with more relevant code. *Updated again: removing chart groupings results in this error: "Unable to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    I am trying to write some stuff in a file using reactJS and nodeJs but it doesnt work. Here is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
...