feat: bubble 组件调整
This commit is contained in:
@ -24,7 +24,7 @@ export default defineComponent({
|
||||
name: 'BubbleList',
|
||||
inheritAttrs: false,
|
||||
props: {} as any,
|
||||
setup(_, { attrs, slots }) {
|
||||
setup(_, { attrs, slots, expose }) {
|
||||
const props = attrs as unknown as BubbleListProps & { class?: any; style?: any };
|
||||
const passThroughAttrs = useAttrs();
|
||||
|
||||
@ -48,7 +48,7 @@ export default defineComponent({
|
||||
const listRef = ref<HTMLDivElement | null>(null);
|
||||
const bubbleRefs = ref<Record<string | number, BubbleRef>>({});
|
||||
|
||||
const listPrefixCls = 'xt-bubble-list'
|
||||
const listPrefixCls = 'xt-bubble-list';
|
||||
|
||||
const [initialized, setInitialized] = useState(false);
|
||||
watchPostEffect(() => {
|
||||
@ -102,6 +102,19 @@ export default defineComponent({
|
||||
});
|
||||
const context = computed(() => ({ onUpdate: onBubbleUpdate }));
|
||||
|
||||
// 暴露控制方法
|
||||
const abortTypingByKey = (key: string | number) => {
|
||||
bubbleRefs.value[key]?.abortTyping?.();
|
||||
};
|
||||
// 对外暴露能力
|
||||
expose({
|
||||
nativeElement: listRef as any,
|
||||
abortTypingByKey,
|
||||
scrollTo: (info: any) => {
|
||||
unref(listRef)?.scrollTo?.(info);
|
||||
},
|
||||
});
|
||||
|
||||
return () => (
|
||||
<BubbleContextProvider value={context.value}>
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user