2

script(obtained from a pinia store):

const moviePosters = store.poster

function removeMovie (value) {
    for(var i = 0; i < movieTitles.length; i++) {
        movieTitles.splice(i, value);
        console.log(movieTitles)
}

html:

<button v-for="options of movieTitles" @click = "removeMovie(options, options)"></button>

This is the array of objects I got back and want to remove a specific one:

Proxy {0: 'Puss in Boots: The Last Wish', 1: 'The Menu'}
 [[Handler]]: Object
 [[Target]]: Array(2)
  0: "Puss in Boots: The Last Wish"
  1: "The Menu"
  length: 2
  [[Prototype]]: Array(0)
 [[IsRevoked]]: false
kevinSpaceyIsKeyserSöze
  • 3,693
  • 2
  • 16
  • 25
Draganson
  • 21
  • 1
  • 1
    Please elaborate – Abbas Shaikh Jan 13 '23 at 06:18
  • This question is unclear to me. What type of values you want to remove and what data `moviePosters` contains. I did not see any reference of using `moviePosters` in your code as well. Also, you have to just pass one param in `removeMovie` as per the function definition. – Debug Diva Jan 13 '23 at 06:47
  • Im trying to remove the first object in the array "puss in boots". moviePosters is and array in a proxy – Draganson Jan 13 '23 at 13:37
  • If the object was created with Vue 3's `ref` or `reactive` functions then the proxy object should be unwrapped with `.value` appended to the object name. Otherwise, there is no special syntax needed for interacting with a proxy object, which I believe is true in this case. Treat it the same as you would a normal object/array. read [this](https://stackoverflow.com/a/64960767/6225326) for more details – yoduh Jan 13 '23 at 14:34

0 Answers0