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

    How to render option values as HTML for q-option-group?

    Help
    2
    3
    362
    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.
    • P
      Paxton last edited by

      Hello,

      I have a q-option group that holds a dynamic set of values:

      <div>
        <q-option-group
           v-model="group"
           :options="options"
           color="primary"
        ></q-option-group>
      </div>
      

      And the values are populated like:

      let questionAnswers = this.currentQuestion.Answers
         this.options = []
         for (const [i,v] of questionAnswers.entries()) {
         this.options.push({label: v, value: String(i)})
      }
      

      The problem is that some of the values have html inside the string. Is there a way I can get the q-option-group to render options as html?

      Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        You won’t be able to do any formatting with HTML in the options label properties. You’ll need to roll your own options group and then use v-html.

        See this (and the warning of using it).

        https://vuejs.org/v2/guide/syntax.html#Raw-HTML

        Scott

        1 Reply Last reply Reply Quote 0
        • P
          Paxton last edited by

          Damn I was afraid of that. Was hoping there was a way. Thanks for the help!

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