Is declaring static text in data option instead of Template an antipattern?


In team we use the v-text directive (instead of mustache) to pass computed strings. This allows us to omit the closing tag and improves the readability of the template.

Now we discuss what to do with the plain text. Should we place it:

  1. in the typical way <span>Plain text</span>.
  2. or with the help of v-text, passing plain text <span v-text="'plain text'"/>.
  3. or with the help of v-text, passing a variable with the string <span v-text="plainText"/>.
    The discussion is between option 1 or 3 and we rejected option 2.

My question is, is declaring plain text as a variable in data() an antipattern? Maybe option 1 is more natural, though not consistent.

Hi, another alternative is to declare a static variable in the Options API,
For example:

export default {
  name: 'HelloWorld',
  data() {
    return {}
  paragraphText: 'HelloWorld'
    <p v-text="$options.paragraphText" />