Fix getIpLocation (fix #4690)

This commit is contained in:
the1812 2024-05-10 20:18:52 +08:00
parent 917b0690e9
commit 1899c12f25

View File

@ -4,9 +4,8 @@ import { defineComponentMetadata } from '@/components/define'
import { CommentItem, CommentReplyItem } from '@/components/utils/comment-apis'
// 新版评论区IP属地获取
const getIpLocation = (element: HTMLElement) => {
const props = (element as any).__vueParentComponent?.props
const reply = props?.reply ?? props?.subReply
const getIpLocation = (item: CommentReplyItem) => {
const reply = item.vueProps
return reply?.reply_control?.location ?? undefined
}
@ -268,7 +267,7 @@ observer.observe(document.head, { childList: true })
const processItems = (items: CommentReplyItem[]) => {
items.forEach(item => {
const location = getIpLocation(item.element)
const location = getIpLocation(item)
if (location !== undefined) {
const replyTime =
item.element.querySelector('.reply-info>.reply-time') ??