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

    Tag losing attributes in quasar framework + vue.js 2

    Help
    2
    4
    1237
    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.
    • A
      anonimo last edited by rstoenescu

      I’m having problems with the quasar framework + vue.js 2 I have a pretty simple component that basically is a link with an an icon inside, but many of these attributes are dynamic. After I started passing the href and target attribute via v-bind the component no longer respects the css part of tag a on. From what I’ve noticed it seems that for some reason the a tag is overwritten and loses the settings leaving only the href attribute.

      Here is the code:

      <template>
        <div :id="_uid" class="social">
          <a :href="styles.url" :target="styles.target" :style="{color: styles.color}" >
            <i :class="['icone', styles.classIco]"></i>
          </a>
        </div>
      </template>
      
      <script>
        import css from '../../assets/js/cssDefault.js'
        export default{
          props: {
            styles: {
              type: Object,
              required: false,
              default: function () {
                return {
                  url: '#',
                  target: '_blank',
                  color: css.color.secondary,
                  classIco: 'ico-fa-question-sign'
                }
              },
              validator: function (styles) {
                let s = {
                  url: {
                    tipo: 'string',
                    padrao: '#'
                  },
                  target: {
                    tipo: 'string',
                    padrao: '_blank'
                  },
                  color: {
                    tipo: 'string',
                    padrao: css.color.secondary
                  },
                  classIco: {
                    tipo: 'string',
                    padrao: 'ico-fa-question-sign'
                  }
                }
                for (let prop in styles) {
                  let tipo = typeof styles[prop]
                  if (!(prop in styles) || tipo !== s[prop].tipo) {
                    styles[prop] = s[prop].padrao
                  }
                }
                return styles
              }
            }
          }
        }
      </script>
      
      <style scoped>
        .social{
          display: inline-block;
          vertical-align: middle;
          margin: 0 auto;
        }
        .social>a,
        .social>a:active,
        .social>a:visited{
          margin-left: 5.6px;
        }
        .social>a:hover{
          cursor: pointer;
        }
        .icone{
          margin: 0 3.5px;
        }
        .icone::before{
          font-size: 14px;
        }
      </style>
      
      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        This is a pure Vue related question. Nothing from Quasar side has any impact on your code. You may want to move this to the Vue forum.
        Do you really need the “scope” added to the <style> tag? That might mingle with vue-loader’s output code.

        1 Reply Last reply Reply Quote 0
        • A
          anonimo last edited by

          In the case of scoped, it makes no difference to me, I just want it to work.
          Detail: is quasar version 0.13.
          I’m new to both technologies, so maybe the mess.

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

            Again, has nothing to do with Quasar. Try in Vue forums for this.

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