mirror of
https://github.com/RhenCloud/Cloud-Home.git
synced 2026-07-26 06:33:57 +08:00
fix: 优化友链展示逻辑,确保友链在组件挂载时正确显示
This commit is contained in:
@@ -181,8 +181,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch, computed } from "vue";
|
||||
import { reactive, ref, watch, computed, onMounted } from "vue";
|
||||
import siteConfig from "../config/siteConfig";
|
||||
defineOptions({ inheritAttrs: false });
|
||||
const props = defineProps({ friends: { type: Array, default: () => [] } });
|
||||
const showFormModal = ref(false);
|
||||
const loading = ref(false);
|
||||
@@ -212,11 +213,15 @@ const shuffle = (list) => {
|
||||
watch(
|
||||
() => props.friends,
|
||||
(val) => {
|
||||
displayedFriends.value = shuffle(val || []);
|
||||
displayedFriends.value = val ? [...val] : [];
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
displayedFriends.value = shuffle(props.friends || []);
|
||||
});
|
||||
|
||||
const exampleJson = computed(() => {
|
||||
const name = siteConfig.profile?.name || siteConfig.siteMeta?.title || "";
|
||||
const url = siteConfig.siteMeta?.url || "";
|
||||
|
||||
Reference in New Issue
Block a user