Skip to content

Commit

Permalink
feat(bulletin-board): [bulletin-board] Add click events
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyiping0628 committed Dec 3, 2024
1 parent acf1191 commit e57af4d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
7 changes: 5 additions & 2 deletions examples/sites/demos/apis/bulletin-board.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,18 @@ export default {
],
events: [
{
name: 'handleClick',
name: 'contentClick',
type: '(event: BulletinBoardData) => void',
defaultValue: '',
desc: {
'zh-CN': '当公告牌内容被点击时触发的回调函数',
'en-US': 'The callback function triggered when the content of the bulletin board is clicked'
},
mode: ['pc'],
pcDemo: 'events'
pcDemo: 'events',
meta: {
stable: '3.20.0'
}
}
],
methods: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<tiny-bulletin-board :tab-title="tabTitle" :data="data" @handleClick="handleClick"></tiny-bulletin-board>
<tiny-bulletin-board :tab-title="tabTitle" :data="data" @contentClick="contentClick"></tiny-bulletin-board>
</template>

<script setup>
Expand Down Expand Up @@ -86,9 +86,9 @@ const data = ref([
}
]
])
function handleClick(item) {
function contentClick(item) {
TinyModal.message({
message: 'click 事件:内容为' + item.text,
message: '触发 contentClick 事件:内容为' + item.text,
status: 'info'
})
}
Expand Down
6 changes: 3 additions & 3 deletions examples/sites/demos/pc/app/bulletin-board/events.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<tiny-bulletin-board :tab-title="tabTitle" :data="data" @handleClick="handleClick"></tiny-bulletin-board>
<tiny-bulletin-board :tab-title="tabTitle" :data="data" @contentClick="contentClick"></tiny-bulletin-board>
</template>

<script>
Expand Down Expand Up @@ -94,9 +94,9 @@ export default {
}
},
methods: {
handleClick(item) {
contentClick(item) {
TinyModal.message({
message: 'click 事件:内容为' + item.text,
message: '触发 contentClick 事件:内容为' + item.text,
status: 'info'
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ export default {
{
demoId: 'events',
name: {
'zh-CN': 'click事件',
'zh-CN': '事件',
'en-US': 'Fold panel click event'
},
desc: {
'zh-CN': '<p>当点击后会触发触发 <code>click</code> 事件。</p>',
'en-US': '<p>When clicked, it will trigger<code>click</code>. </p>'
'zh-CN': '<p>当点击内容后会触发 <code>contentClick</code> 事件。</p>',
'en-US': '<p>When clicked, it will trigger <code>contentClick</code> . </p>'
},
codeFiles: ['events.vue']
}
Expand Down
2 changes: 1 addition & 1 deletion packages/renderless/src/bulletin-board/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ export const computedMoreLink =
export const handleBulletinBoardClick =
({ emit }) =>
(item) => {
emit('handleClick', item)
emit('contentClick', item)
}

0 comments on commit e57af4d

Please sign in to comment.