1

Using Vue Material components I want concatenate a text with a variable's value to make the md-content text.

<md-dialog-confirm
  :md-active.sync="showDialogConfirmDelete"
  md-title="Deletar Fornecedor"
  md-content="Concate this with {{fornecedorToDelete.nome}}"
></md-dialog-confirm>

...

data() {
   return { fornecedorToDelete: {nome: "Name"} }
}

but it doesn't works, the md-content's value is not set.

2 Answers 2

3

Use a computed property:

:md-content="mdContent"

Then define mdContent in your computed property:

computed: {
  mdContent: {
    get: function() {
      return `Concate this with ${this.fornecedorToDelete.nome}`
    }
  }
}

Or you can (ew) do it the dirty way:

:md-content="`Concate this with ${fornecedorToDelete.nome}`"
Sign up to request clarification or add additional context in comments.

Comments

1

You could bind md-content to a concatenated string with the data property as follows:

 :md-content="Concate this with+'fornecedorToDelete.nome'" 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.