它应该被定义为计算属性,因为它取决于其他属性的值(对
name
做同样的事情):
<script setup>
import { useAuth0 } from '@auth0/auth0-vue';
let auth0 = process.client ? useAuth0() : undefined;
const name = computed(()=>auth0?.isAuthenticated ? auth0?.user?.value.nickname:'');
const image = computed(()=>auth0?.isAuthenticated ? auth0?.user?.value.picture:'');
</script>