0

I see a similar question being asked for react js What is the meaning of {...this.props} in Reactjs

However I'm not sure if it does the same thing in vue js. I have no experience with react js but I'm guessing props in react js does the same thing as vue's props. If that is the case I'm not quite sure what {...this.data} is being used for. I believe it is different to {...this.prop}?

Can someone explain what it is actually doing?

export default {
  data() {
    return {
      tabs: [
        {
          name: "home",
          to: "/",
          title: "testing ",
          active: false
        },
        {
          name: "browse",
          to: "/test/all",
          title: "Testing",
          active: false
        },
      ]
    };
  },


methods: {
    setActiveTab(index) {
      for (var i in this.tabs) {
        let tab = { ...this.tabs[i] };

        #Additional code
      }
    }

Mark
  • 3,138
  • 5
  • 19
  • 36
  • 2
    `...` is a `spread operator`. Read more about them here : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax – Prasanna Dec 06 '19 at 00:26
  • 2
    The spread operator is a JavaScript language feature. It is not specific to React or Vue. – skirtle Dec 06 '19 at 00:28
  • I dont like your question , coz it sound like lazy to type `...` on internet – David Japan Dec 06 '19 at 00:37

0 Answers0