App.vue 882 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <div id="app">
  3. <lemon-im v-bind="IMData"
  4. @pull-friends-message="pullFriendsMessage"></lemon-im>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. name: "app",
  10. data () {
  11. this.friendData = {
  12. "id": 1,
  13. "diaplayName": "贤心",
  14. "avatarPath": "a.jpg",
  15. "sign": "这些都是测试数据,实际使用请严格按照该格式返回"
  16. }
  17. return {
  18. IMData: {
  19. friends: [],
  20. groups: [],
  21. }
  22. };
  23. },
  24. mounted: function () {
  25. setInterval(() => {
  26. this.IMData.friends.push({ ...this.friendData })
  27. this.friendData.id++
  28. }, 1000)
  29. },
  30. methods: {
  31. pullFriendsMessage (data, resolve, reject) {
  32. resolve([{ ...this.friendData }])
  33. //resolve([...this.friendData.id])
  34. this.friendData.id++
  35. },
  36. pullGroups () {
  37. }
  38. }
  39. };
  40. </script>
  41. <style lang="sass"></style>