Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open URL scheme (mailto, tel) on q-item click?

I wish to make a <q-list> of contacts with their telephone numbers, emails and addresses and I'm trying to make the <q-item>s clickable so that when the user clicks on any of the q-items, the phone dialer/mail-client/naviation app will fire up.

From what I gather <q-item> only supports @click but I can't think of a way other than openURL to pass the URL scheme (eg "tel:55512345"). The documentation however advises against it. What is good way of doing it?

    <q-item clickable>
      <q-item-section avatar>
        <q-icon name="mail" />
      </q-item-section>
      <q-item-section>
        <q-item-label>[email protected]</q-item-label>
         <q-item-label caption>email</q-item-label>
       </q-item-section>
    </q-item>
like image 606
FotisK Avatar asked Sep 21 '25 06:09

FotisK


1 Answers

Since the docs advises to use an a(nchor) element for it, why not do so by using the tag prop and the native href for the URL scheme:

<q-item 
  tag="a"
  href="tel:55512345"
  clickable>
  <q-item-section avatar>
    <q-icon name="mail" />
  </q-item-section>
  <q-item-section>
    <q-item-label>[email protected]</q-item-label>
    <q-item-label caption>email</q-item-label>
  </q-item-section>
</q-item>

like image 124
Yom T. Avatar answered Sep 22 '25 23:09

Yom T.