M
M
Maxim js2021-07-27 15:17:39
Vue.js
Maxim js, 2021-07-27 15:17:39

How to substitute a variable into the radio buttons option text?

options: [{
      text: `'текст ${this.test}'`, value: 'below', // конструкция с обратными кавычками не работает
    }, {
      text: 'текст 2', value: 'between',
    }, {
      text: 'текст 3', value: 'above',
    }],

How can I substitute a value with a variable instead of numbers?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2021-07-27
@winers

`'текст ${this.test}'`
Why even single quotes? They are not needed.

D
Dmitry Gololobov, 2021-07-27
@dGololobov

options: [{
      text: `текст ${this.test}`, value: 'below', // конструкция с обратными кавычками не работает
    }, {
      text: 'текст ' + this.anyTestParam, value: 'between',
    }, {
      text: 'текст 3', value: 'above',
    }],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question