Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporate-culture-qd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王立鹏
corporate-culture-qd
Commits
f15f32a4
Commit
f15f32a4
authored
Apr 17, 2026
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【需求 21402】 feat: 加入转化at评论>html字符串的指令
parent
afc48ef5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
index.ts
src/directives/index.ts
+1
-0
vCommentParse.ts
src/directives/vCommentParse.ts
+20
-0
main.ts
src/main.ts
+4
-0
No files found.
src/directives/index.ts
0 → 100644
View file @
f15f32a4
export
*
from
'./vCommentParse'
src/directives/vCommentParse.ts
0 → 100644
View file @
f15f32a4
import
type
{
Directive
}
from
'vue'
import
router
from
'@/router'
// 将评论内容中at 添加点击事件
export
const
vParseComment
:
Directive
=
{
mounted
(
el
:
HTMLElement
,
binding
:
DirectiveBinding
)
{
const
{
value
:
onClickedCallback
}
=
binding
el
.
querySelectorAll
(
'span[data-id]'
).
forEach
((
item
)
=>
{
item
.
addEventListener
(
'click'
,
()
=>
{
const
id
=
(
item
as
HTMLElement
).
dataset
.
id
const
isReal
=
(
item
as
HTMLElement
).
dataset
.
isreal
if
(
id
&&
isReal
)
{
console
.
log
(
id
,
'id'
)
router
.
push
(
`/otherUserPage/
${
id
}
/
${
isReal
}
`
)
onClickedCallback
?.()
}
})
})
},
}
src/main.ts
View file @
f15f32a4
...
...
@@ -16,6 +16,8 @@ import { createNotivue } from 'notivue'
import
'notivue/notification.css'
import
'notivue/animations.css'
import
{
vParseComment
}
from
'@/directives'
if
(
import
.
meta
.
env
.
MODE
===
'production'
)
{
import
(
'@/utils/version'
).
then
(({
loopGetVersion
})
=>
loopGetVersion
())
}
...
...
@@ -33,6 +35,8 @@ app.use(notivue)
app
.
use
(
createPinia
())
app
.
use
(
router
)
// 全局指令挂载
app
.
directive
(
'parse-comment'
,
vParseComment
)
// 全局组件挂载
app
.
component
(
'SvgIcon'
,
SvgIcon
)
app
.
mount
(
'#app'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment