0
点赞
收藏
分享

微信扫一扫

C语言-用指向指针的指针的方法对n个整数排序并输出。要求将排序单独写成一个函数。n个整数在主函数中输入,最后在主函数中输出。

求阙者 2024-08-24 阅读 29

uniapp中scroll-view聊天界面滚动到底部展示最新消息

自我记录

方案一

<scroll-view
  scroll-y
  class="scroll-view-main"
  @scroll="onScroll"
  scroll-with-animation
  :scroll-into-view="scrollId"
>
<!-- xxxxx 消息内容 -->
<!-- xxxxx 消息内容 -->
<!-- xxxxx 消息内容 -->
<!-- xxxxx 消息内容 -->

  <!-- 显示最新消息 -->
  <view id="msg-001"/>
</scroll-view>
// 滚动指定元素ID
const scrollId = ref<string>()

// 处理滚动位置事件
const handleScrollLocation = async (id: number | undefined) => {
  scrollId.value = id ? `msg-${id}` : undefined
  await nextTick()
  scrollId.value = undefined
}

// 发送消息公共方法
const handleSendCommon = (val: string) => {
  infoParams.value.question = val
  // 创建临时数组
  const TEMP_ITEM: ChatWriteMsgItem = {
    messageId: 999,
    role: 'user',
    message: val,
    createTime: moment().format('YYYY-MM-DD hh:mm:ss'),
  }
  handleScrollLocation(TEMP_ITEM.messageId)
  handleChatWrite()
}

如有转载 请备注原文地址!

举报

相关推荐

0 条评论