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