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

    Custom Directive not working properly

    Framework
    2
    2
    133
    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
      Avada Kedavra last edited by

      I was faced with the following problem.
      I create a custom Directive that identifies the contents of the input field but the text field is highlighted only when re-setting the focus.

      <q-input
              outlined 
              :value="name"
              autofocus
              v-select-all
              ref="name"
              label="Task Name"
              class="col"
              >
      

      Derective code

      selectAll:{
             inserted(el){
                 let input = el.querySelector('.q-field__native')
                 input.addEventListener('focus', ()=> {
                         if (input.value.length) {
                                  input.select()
                                  console.log('input selected')
                              }
                     })
                 }
             }
      

      Directive though autofocus sets the focus to the desired field to me, but the content is not highlighted. What to do?(

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @Avada Kedavra last edited by

        @Avada-Kedavra

        People here can help you better if you create a codepen.io ( very easy to do , just extend one of quasar’s example codepens) to demo your problem.

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