P
P
pegas2018-11-10 20:27:00
Vue.js
pegas, 2018-11-10 20:27:00

How to pass props in single file Vue components?

When I export a component

<script>

  export default {
    data () {
      props: ['a'],
      return {
        qwe: "Привет 2"
      }
    }
  }
</script>


In the console I get an error that some kind of loader / loader is needed -
"Module parse failed: Unexpected token (14:4)
You may need an appropriate loader to handle this file type."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-11-10
@1PeGaS

export default {
  data () {
    props: ['a'],
    return {
      qwe: "Привет 2"
    }
  }
}

It's some kind of schizophrenia. Probably meant
export default {
  props: ['a'],
  data() {
    return {
      qwe: "Привет 2"
    }
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question