im-ui-mobile 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,7 +52,7 @@
52
52
  import ImChatMessageItem from '../im-chat-message-item/index.vue'
53
53
 
54
54
  export default {
55
- name: 'ChatBox',
55
+ name: 'ImChatBox',
56
56
  components: {
57
57
  ImChatMessageItem
58
58
  },
@@ -21,34 +21,48 @@
21
21
  </view>
22
22
  </template>
23
23
 
24
- <script setup lang="ts">
24
+ <script setup>
25
25
  import { computed } from 'vue'
26
26
 
27
- interface Props {
28
- type?: 'default' | 'group'
29
- avatar?: string
30
- name: string
31
- time: string
32
- lastMessage: string
33
- unreadCount?: number
34
- }
27
+ // 设置组件名称(重要!)
28
+ defineOptions({
29
+ name: 'ImChatItem'
30
+ })
35
31
 
36
- const props = withDefaults(defineProps<Props>(), {
37
- type: 'default',
38
- avatar: '',
39
- unreadCount: 0
32
+ const props = defineProps({
33
+ type: {
34
+ type: String,
35
+ default: 'default',
36
+ validator: (value) => ['default', 'group'].includes(value)
37
+ },
38
+ avatar: {
39
+ type: String,
40
+ default: ''
41
+ },
42
+ name: {
43
+ type: String,
44
+ required: true
45
+ },
46
+ time: {
47
+ type: String,
48
+ required: true
49
+ },
50
+ lastMessage: {
51
+ type: String,
52
+ required: true
53
+ },
54
+ unreadCount: {
55
+ type: Number,
56
+ default: 0
57
+ }
40
58
  })
41
59
 
42
- const emit = defineEmits<{
43
- click: [event: any]
44
- }>()
60
+ const emit = defineEmits(['click'])
45
61
 
46
62
  const displayName = computed(() => props.name.charAt(0))
47
- const displayUnreadCount = computed(() =>
48
- props.unreadCount > 99 ? '99+' : props.unreadCount
49
- )
63
+ const displayUnreadCount = computed(() => props.unreadCount > 99 ? '99+' : props.unreadCount)
50
64
 
51
- const handleClick = (event: any) => {
65
+ const handleClick = (event) => {
52
66
  console.log('🔍 uni 对象检查:', {
53
67
  hasUni: typeof uni !== 'undefined',
54
68
  hasShowToast: typeof uni?.showToast === 'function',
@@ -34,7 +34,7 @@
34
34
 
35
35
  <script>
36
36
  export default {
37
- name: 'ChatMessageItem',
37
+ name: 'ImChatMessageItem',
38
38
  props: {
39
39
  position: {
40
40
  type: String,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "im-ui-mobile",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "A Vue3.0 + typescript instant messaging component library for Uniapp",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -1,43 +1,18 @@
1
- interface Props {
2
- type?: 'default' | 'group';
3
- avatar?: string;
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "click", ...args: any[]) => void;
3
+ type: string;
4
+ avatar: string;
4
5
  name: string;
5
6
  time: string;
6
7
  lastMessage: string;
7
- unreadCount?: number;
8
- }
9
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
10
- type: string;
11
- avatar: string;
12
8
  unreadCount: number;
13
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
- click: (event: any) => void;
15
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
16
- type: string;
17
- avatar: string;
18
- unreadCount: number;
19
- }>>> & Readonly<{
20
- onClick?: ((event: any) => any) | undefined;
21
- }>, {
22
- type: "default" | "group";
23
- avatar: string;
24
- unreadCount: number;
25
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
- export default _default;
27
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
- type __VLS_TypePropsToRuntimeProps<T> = {
29
- [K in keyof T]-?: {} extends Pick<T, K> ? {
30
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
- } : {
32
- type: import('vue').PropType<T[K]>;
33
- required: true;
9
+ $props: {
10
+ readonly type?: string | undefined;
11
+ readonly avatar?: string | undefined;
12
+ readonly name?: string | undefined;
13
+ readonly time?: string | undefined;
14
+ readonly lastMessage?: string | undefined;
15
+ readonly unreadCount?: number | undefined;
34
16
  };
35
- };
36
- type __VLS_WithDefaults<P, D> = {
37
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
38
- default: D[K];
39
- }> : P[K];
40
- };
41
- type __VLS_Prettify<T> = {
42
- [K in keyof T]: T[K];
43
- } & {};
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
18
+ export default _default;