Bind directive to function instead of function call (#3091)

v-if="showResult(data)" evaluates once
v-if="showResult" is reactive;

`data` also doesn't need to be passed here
because it is already accessible from `this`.
This commit is contained in:
Emma 2023-01-19 10:58:12 -05:00 committed by GitHub
parent 0f4bf0e87e
commit 12e9565dbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -54,7 +54,8 @@ export default defineComponent({
*
* @return {bool} false to hide the video, true to show it
*/
showResult: function (data) {
showResult: function () {
const { data } = this
if (!data.type) {
return false
}

View File

@ -1,6 +1,6 @@
<template>
<div
v-if="showResult(data)"
v-if="showResult"
v-observe-visibility="firstScreen ? false : {
callback: onVisibilityChanged,
once: true,