No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Eval binded data in string

    Help
    2
    5
    727
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      etcodev last edited by

      Hi,

      In a <q-option-group> component I would like to input a variable into labels. But I don’t know how to achieve that.

      Here is an example of what I would like to do:

      <q-option-group
        type="radio"
        v-model="my-v-model"
        :options="[
          {value: '1', label: '{{ user.fullName }} helped me'},
          {value: '2', label: '{{ user.fullName }}  di not help me'},
        ]"
      />
      

      How to evaluate {{ user.fullName }} inside my string ?

      Thanks for helping 😳

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        <q-option-group
          type="radio"
          v-model="my-v-model"
          :options="[
            {value: '1', label: `${user.fullName} helped me`},
            {value: '2', label: `${user.fullName}  di not help me`},
          ]"
        />
        
        1 Reply Last reply Reply Quote 0
        • E
          etcodev last edited by

          Wouaw ! Thanks a lot! I don’t know how I could have found the answer by myself on the internet… I think it should be somewhere in the VueJS’s doc but I did not found…

          Best regards

          1 Reply Last reply Reply Quote 0
          • E
            etcodev last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • E
              etcodev last edited by

              One more question related to this topic: what about if I want to put this text in a “config” file ? Because in my “config” file, the “user” variable doesn’t exist.
              In my case, I put all the texts in one “plugin” file (/src/plugins/config.js) and if I move the option’s array into the config.js file, I have the error saying that “‘user’ is not defined”.
              I don’t know if plugins are the best solution to centralize all the “text” variables of my app ? But if so, how to include variables in my texts ?

              Thanks

              1 Reply Last reply Reply Quote 0
              • First post
                Last post