Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v-slot with v-if #9391

Closed
madmoizo opened this issue Jan 30, 2019 · 5 comments
Closed

v-slot with v-if #9391

madmoizo opened this issue Jan 30, 2019 · 5 comments

Comments

@madmoizo
Copy link

Version

2.6.0-beta.3

Reproduction link

https://codepen.io/frlinw/pen/zeobvd

Steps to reproduce

Click on the "click me" button

What is expected?

content should be displayed and changed on click

What is actually happening?

v-slot inside a wrapper with v-if is not displayed

@yyx990803
Copy link
Member

The new syntax requires <template v-slot> to be at the root level inside the receiving component.

Proper usage:

<Dropdown>
  <template #title>
    <template v-if="flag">Bonjour</template>
    <template v-else>Hello</template>
  </template>
</Dropdown>

Maybe we can add a warning for this.

@madmoizo
Copy link
Author

Will the slot syntax be removed in a future release?

@yyx990803
Copy link
Member

@frlinw likely, but only in a major release.

@madmoizo
Copy link
Author

madmoizo commented Feb 5, 2019

Additionnally, if you put v-if/v-else on a parent, it requires a key which wasn't necessary with the good old slot.
https://codepen.io/frlinw/pen/zeobvd

@Austio
Copy link

Austio commented Aug 13, 2019

@yyx990803 I think this will prevent conditional rendering of slots.

  <vg-apollo-query
    :query="query"
    :variables="variables"
    :prefetch="prefetch"
    v-on="$listeners"
  >
    <template #default="{ result: { data, error }, isLoading, gqlError }">
      <template
        v-if="isLoading"
        #initialLoading
      >
        <div data-test-initial-loading class="spinner-icon" />
      </template>
  </vg-apollo-query>

kikuomax added a commit to kikuomax/buefy that referenced this issue May 8, 2021
- Files in `docs/pages/components/table/examples` are updated.
- In `ExAsyncData.vue`,
    - The `truncate` filter is removed and implemented as a method
      because Vue 3 no longer supports filters.
- In `ExCheckable.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `checked-rows.sync` --> `v-model:checked-rows`.
- In `ExCustomDetailedRow.vue`,
    - Obsolete `slot` and `slot-scope` directives in a template are
      replaced with `v-slot`.
- In `ExFooter.vue`,
    - `v-if` and `v-else` directives are enclosed in a separate
      template with `#footer` (`v-slot`) directive. Combining `v-if`
      or `v-else`, and `v-slot` in a same template caused a maximum
      recursion exceeding error. If `v-slot` was inside `v-if`, I got
      a compilation error. Wrapping a `v-if` or `v-else` directive
      with a `v-slot` looks a proper syntax,
      vuejs/vue#9391 (comment)

      This change lets `Table` component take a fragment into account
      when a footer is rendered.
- In `ExPaginationSort.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `:current-page.sync` --> `v-model:current-page`.
- In `ExSelection.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `:selected.sync` --> `v-model:selected`.
- In `ExSortMultiple.vue`,
    - `!multiColumnSortingEnabled` is replaced with
      `multiColumnSortingDisabledOrUndefined` when `disabled`
      attribute is set. Because setting a boolean attribute `false`
      does not remove it on Vue 3. To remove an attribute, `null` or
      `undefined` has to be given.
      `multiColumnSortingDisabledOrUndefined` returns `true` or
      `undefined`.
kikuomax added a commit to kikuomax/buefy that referenced this issue Jul 22, 2022
- Files in `docs/pages/components/table/examples` are updated.
- In `ExAsyncData.vue`,
    - The `truncate` filter is removed and implemented as a method
      because Vue 3 no longer supports filters.
- In `ExCheckable.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `checked-rows.sync` --> `v-model:checked-rows`.
- In `ExCustomDetailedRow.vue`,
    - Obsolete `slot` and `slot-scope` directives in a template are
      replaced with `v-slot`.
- In `ExFooter.vue`,
    - `v-if` and `v-else` directives are enclosed in a separate
      template with `#footer` (`v-slot`) directive. Combining `v-if`
      or `v-else`, and `v-slot` in a same template caused a maximum
      recursion exceeding error. If `v-slot` was inside `v-if`, I got
      a compilation error. Wrapping a `v-if` or `v-else` directive
      with a `v-slot` looks a proper syntax,
      vuejs/vue#9391 (comment)

      This change lets `Table` component take a fragment into account
      when a footer is rendered.
- In `ExPaginationSort.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `:current-page.sync` --> `v-model:current-page`.
- In `ExSelection.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `:selected.sync` --> `v-model:selected`.
- In `ExSortMultiple.vue`,
    - `!multiColumnSortingEnabled` is replaced with
      `multiColumnSortingDisabledOrUndefined` when `disabled`
      attribute is set. Because setting a boolean attribute `false`
      does not remove it on Vue 3. To remove an attribute, `null` or
      `undefined` has to be given.
      `multiColumnSortingDisabledOrUndefined` returns `true` or
      `undefined`.
kikuomax added a commit to kikuomax/buefy that referenced this issue Jul 7, 2023
- Files in `docs/pages/components/table/examples` are updated.
- In `ExAsyncData.vue`,
    - The `truncate` filter is removed and implemented as a method
      because Vue 3 no longer supports filters.
- In `ExCheckable.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `checked-rows.sync` --> `v-model:checked-rows`.
- In `ExCustomDetailedRow.vue`,
    - Obsolete `slot` and `slot-scope` directives in a template are
      replaced with `v-slot`.
- In `ExFooter.vue`,
    - `v-if` and `v-else` directives are enclosed in a separate
      template with `#footer` (`v-slot`) directive. Combining `v-if`
      or `v-else`, and `v-slot` in a same template caused a maximum
      recursion exceeding error. If `v-slot` was inside `v-if`, I got
      a compilation error. Wrapping a `v-if` or `v-else` directive
      with a `v-slot` looks a proper syntax,
      vuejs/vue#9391 (comment)

      This change lets `Table` component take a fragment into account
      when a footer is rendered.
- In `ExPaginationSort.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `:current-page.sync` --> `v-model:current-page`.
- In `ExSelection.vue`,
    - `.sync` is replaced with a new syntax of `v-model:`.
      `:selected.sync` --> `v-model:selected`.
- In `ExSortMultiple.vue`,
    - `!multiColumnSortingEnabled` is replaced with
      `multiColumnSortingDisabledOrUndefined` when `disabled`
      attribute is set. Because setting a boolean attribute `false`
      does not remove it on Vue 3. To remove an attribute, `null` or
      `undefined` has to be given.
      `multiColumnSortingDisabledOrUndefined` returns `true` or
      `undefined`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants