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
    1. Home
    2. losika
    3. Best
    L
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 1
    • Groups 0

    Best posts made by losika

    • Make own component from Quasar component

      Hello,

      Maybe my question is not really Quasar specific but I did not find any answer till now.

      I want to make my own component from Quasar components. For example I have this in my vue file:

      <q-select filter filter-placeholder="select" :options="[{label: 'a1', value: 'a1'},{label: 'a2', value: 'a2'},{label: 'a3', value: 'a3'}]" v-model="filtera"/>
      <q-select filter filter-placeholder="select" :options="[{label: 'b1', value: 'b1'},{label: 'b2', value: 'b2'},{label: 'b3', value: 'b3'}]" v-model="filterb"/>
      

      As you can see I use two q-select component with different arrays but with the same class definitions (filter and filter-placeholder). I would like to make a new component where these two class style added and I would like to use the new component in my vue like this:

      <m-select :options="[{label: 'a1', value: 'a1'},{label: 'a2', value: 'a2'},{label: 'a3', value: 'a3'}]" v-model="filtera"/>
      <m-select :options="[{label: 'b1', value: 'b1'},{label: 'b2', value: 'b2'},{label: 'b3', value: 'b3'}]" v-model="filterb"/>
      

      So I would write only the difference.

      I tried everything: mixins and extends as well but nothing works. This is my “almost” solution:

      <template>
      <q-select filter filter-placeholder=“select”/>
      </template>

      <script>
      import {
      QSelect
      } from ‘quasar’

      export default {
      name: ‘m-select’,
      components: {
      QSelect
      },
      mixins: [QSelect]
      }
      </script>

      But this is not working because I have warnings that I need to use required props “value” and “options”.

      What is the solution? Is it possible in Vue.js?

      Thanks

      posted in Framework
      L
      losika