vue3 How can this be achieved?

Asked 1 years ago, Updated 1 years ago, 56 views

We are currently creating a page that lists posts from users.
I would like to set up a menu that contains options such as Edit and Delete in each of those posts.
The menu opens and closes by clicking the button located in the lower left corner of each post.

The menu itself is created with components of vue.

If there is only one post, you can mount it.
There is at least one post and you must mount all of it.
(If there are 100 pieces, mount 100 pieces)

It hasn't been long since I started learning vue, so I have little idea what to do.

I use PHP for the backend, but should I mount the number of posts in foreach?
In that case, if it is 100, 100 mount lines will be printed in the JS file, but is it usually implemented like that...?

Could you tell me what to do in this case?

2022/1/20

The image is a menu that opens and closes when you click on each post as shown in the image.
Enter a description of the image here

javascript vue.js

2022-09-30 14:51

1 Answers

(v3.ja.vuejs.org) List Rendering page contains an example of "ToDo List".

Define items as components and
todo-item How does $emit('remove') run todos.splice(index,1) and remove the item?
You may want to try moving it.

Specify the todos Array equivalent of this program in PHP or
Or Fetch to get it.


2022-09-30 14:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.