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

    Problem understanding why the transition doesn't transfer to the sloted content

    Help
    1
    3
    236
    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.
    • W
      wolfiton last edited by wolfiton

      Hi everyone,

      I create a custom horizontal menu component but have problems making the slotted content use the custom transition.

      App.vue content

      <template>
        <div id="q-app">
          <router-view />
        </div>
      </template>
      
      <script>
      export default {
        name: "App"
      };
      </script>
      
      <style>
      .hmenu-enter-active,
      .hmenu-leave-active {
        opacity: 1;
        margin-left: 10px;
        transition: all 1s ease-out;
      }
      .hmenu-enter,
      .hmenu-leave-to {
        opacity: 0;
        margin-left: -300px;
        transition: all 1s ease-in-out;
      }
      </style>
      

      HorizontalMenu.vue

      <template>
        <div>
          <span>
            <q-btn
              flat
              dense
              round
              icon="menu"
              aria-label="Menu"
              @click="show = !show"
              label="Menu"
            />
      
            <transition name="hmenu">
              <slot name="h-links">
                <q-list
                  v-if="show"
                  dense
                  bordered
                  padding
                  class="rounded-borders h-nav"
                >
                  <q-item clickable v-ripple>
                    <q-item-section>
                      Home
                    </q-item-section>
                  </q-item>
      
                  <q-item clickable v-ripple>
                    <q-item-section>
                      About
                    </q-item-section>
                  </q-item>
      
                  <q-item clickable v-ripple>
                    <q-item-section>
                      Comment
                    </q-item-section>
                  </q-item>
                </q-list>
              </slot>
            </transition>
          </span>
        </div>
      </template>
      
      <script>
      export default {
        name: "HorizontalMenu",
        data() {
          return {
            show: true
          };
        },
        props: {
          icon: {
            type: String,
            default: ""
          },
          lorem: {
            type: String,
            default: "A simple card"
          }
        },
        methods: {
          ClickMe() {
            console.log("I am clicked");
          }
        }
      };
      </script>
      
      <style scoped>
      .h-nav {
        display: flex;
        flex-direction: row;
      }
      </style>
      
      

      MainLayout.vue

      <template>
        <q-layout view="lHh Lpr lFf">
          <q-header elevated>
            <HorizontalMenu>
              <template v-slot:h-links>
                <q-list
                  v-if="show"
                  dense
                  bordered
                  padding
                  class="rounded-borders h-nav"
                >
                  <q-item clickable v-ripple>
                    <q-item-section>
                      Slotted
                    </q-item-section>
                  </q-item>
                </q-list>
              </template>
            </HorizontalMenu>
            <q-toolbar>
              <q-toolbar-title>
                Quasar App
              </q-toolbar-title>
            </q-toolbar>
          </q-header>
      
          <q-page-container>
            <router-view />
          </q-page-container>
        </q-layout>
      </template>
      
      <script>
      import HorizontalMenu from "components/HorizontalMenu";
      
      export default {
        name: "MainLayout",
      
        components: {
          HorizontalMenu
        },
      
        data() {
          return {
            show: true
          };
        },
        methods: {}
      };
      </script>
      

      The full code can be found here https://github.com/wolfiton/horizontal-menu for any further testing.

      Thanks in advance for any explanation or guidance

      1 Reply Last reply Reply Quote 0
      • W
        wolfiton last edited by

        Is this related to Vue or this is something spefici to quasar, to not allow sloted content to be transitioned by the parent component?

        1 Reply Last reply Reply Quote 0
        • W
          wolfiton last edited by

          I created sandbox with this problem here sandbox link

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