[Vuejs]-Qsplitter output value

1👍

Option 1

This can be achieved by using the splitter event @update:model-value seen in the docs here

Example

<div class="filter-container">
        <q-splitter v-model="splitterModel" @update:model-value="handleUpdate">
          <template v-slot:before>
            <div>
              <q-splitter v-model="splitterModel2">
                <template v-slot:before>
                    <Buttons/>
                </template>

                <template v-slot:after>
                    <Buttons/>
                </template>
              </q-splitter>
            </div>
          </template>

          <template v-slot:after>
            <div>
              <q-splitter v-model="splitterModel3">
                <template v-slot:before>
                    <Buttons/>
                </template>
                <template v-slot:after>
                    <Buttons/>
                </template>
              </q-splitter>
            </div>
          </template>
        </q-splitter>
      </div>

setup() {
   const splitterModel = ref(50);
   const splitterModel2 = ref(50);
   const splitterModel3 = ref(50);
   function handleUpdate(value) {
       // Do what you need to do with value here
       console.log(value);
   }
    ...
return {
splitterModel,
splitterModel2,
splitterModel3,
handleUpdate,
...

Option 2

Can also just set up a watcher as explained here

👤Multi

Leave a comment