H
H
hckn2018-12-29 12:12:36
Vue.js
hckn, 2018-12-29 12:12:36

How to modify props, or...?

I am rewriting legacy to Vue and I want to do it as a prop

sitewide     = config.sitewide === true ? ';path=/' : ''

Those. if I pass a prop sitewide, then the value must be ';path=/', otherwise it's an empty string. It is not clear how it is better to do this so as not to cut an additional variable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2018-12-29
@hckn

props: {
  siteWide: {
    type: Boolean,
    default: false,
  }
},
computed: {
  siteWidePath() {
    return this.siteWide ? ';path=/' : '';
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question