Files
yudao-ui-admin-vue3/src/views/chat/components/Friends/Index.vue

36 lines
861 B
Vue
Raw Normal View History

2023-09-20 17:51:50 +08:00
<template>
<view
class="flex flex-col items-center h-full py-2 b-1 b-gray b-solid"
style="width: 248px; min-width: 248px"
>
<view class="flex flex-col w-full">
<FriendItem
2023-09-22 16:30:43 +08:00
v-for="(item, index) in friendStore.friendList"
2023-09-20 17:51:50 +08:00
:key="item.id"
:index="index"
:friend="item"
2023-09-22 16:30:43 +08:00
@click="() => onFriendClick(item)"
2023-09-20 17:51:50 +08:00
/>
</view>
</view>
</template>
<script lang="ts" setup>
import FriendItem from '../FriendItem/Index.vue'
import { useFriendStore } from '../../store/friendstore'
import { onMounted } from 'vue'
2023-09-22 16:30:43 +08:00
import Friend from '../../model/Friend'
2023-09-20 17:51:50 +08:00
defineOptions({ name: 'Friends' })
2023-09-22 16:30:43 +08:00
const friendStore = useFriendStore()
2023-09-20 17:51:50 +08:00
onMounted(() => {
// set default conversation
})
2023-09-22 16:30:43 +08:00
const onFriendClick = (friend: Friend) => {
console.log('====>', friend)
friendStore.setCurrentFriend(friend)
}
2023-09-20 17:51:50 +08:00
</script>