(props: BaseTransitionProps, { slots }: SetupContext)
| 150 | props: BaseTransitionPropsValidators, |
| 151 | |
| 152 | setup(props: BaseTransitionProps, { slots }: SetupContext) { |
| 153 | const instance = getCurrentInstance()! |
| 154 | const state = useTransitionState() |
| 155 | |
| 156 | return () => { |
| 157 | const children = |
| 158 | slots.default && getTransitionRawChildren(slots.default(), true) |
| 159 | const child = |
| 160 | children && children.length |
| 161 | ? findNonCommentChild(children) |
| 162 | : // Keep explicit default-slot conditionals on the same transition path |
| 163 | // as regular v-if branches, which render a comment placeholder. |
| 164 | instance.subTree |
| 165 | ? createCommentVNode() |
| 166 | : undefined |
| 167 | if (!child) { |
| 168 | return |
| 169 | } |
| 170 | |
| 171 | // there's no need to track reactivity for these props so use the raw |
| 172 | // props for a bit better perf |
| 173 | const rawProps = toRaw(props) |
| 174 | const { mode } = rawProps |
| 175 | // check mode |
| 176 | if ( |
| 177 | __DEV__ && |
| 178 | mode && |
| 179 | mode !== 'in-out' && |
| 180 | mode !== 'out-in' && |
| 181 | mode !== 'default' |
| 182 | ) { |
| 183 | warn(`invalid <transition> mode: ${mode}`) |
| 184 | } |
| 185 | |
| 186 | if (state.isLeaving) { |
| 187 | return emptyPlaceholder(child) |
| 188 | } |
| 189 | |
| 190 | // in the case of <transition><keep-alive/></transition>, we need to |
| 191 | // compare the type of the kept-alive children. |
| 192 | const innerChild = getInnerChild(child) |
| 193 | if (!innerChild) { |
| 194 | return emptyPlaceholder(child) |
| 195 | } |
| 196 | |
| 197 | let enterHooks = resolveTransitionHooks( |
| 198 | innerChild, |
| 199 | rawProps, |
| 200 | state, |
| 201 | instance, |
| 202 | // #11061, ensure enterHooks is fresh after clone |
| 203 | hooks => (enterHooks = hooks), |
| 204 | ) |
| 205 | |
| 206 | if (innerChild.type !== Comment) { |
| 207 | setTransitionHooks(innerChild, enterHooks) |
| 208 | } |
| 209 |
nothing calls this directly
no test coverage detected