标签的一个属性,该属性指定在何处显示链接的资源
+ }
+ `
+ }
]
}
diff --git a/examples/sites/demos/pc/app/bulletin-board/events-composition-api.vue b/examples/sites/demos/pc/app/bulletin-board/events-composition-api.vue
new file mode 100644
index 0000000000..7eea0b3455
--- /dev/null
+++ b/examples/sites/demos/pc/app/bulletin-board/events-composition-api.vue
@@ -0,0 +1,95 @@
+
+
+
+
+
diff --git a/examples/sites/demos/pc/app/bulletin-board/events.spec.ts b/examples/sites/demos/pc/app/bulletin-board/events.spec.ts
new file mode 100644
index 0000000000..53a3c6e41e
--- /dev/null
+++ b/examples/sites/demos/pc/app/bulletin-board/events.spec.ts
@@ -0,0 +1,11 @@
+import { test, expect } from '@playwright/test'
+
+test('测试点击事件', async ({ page }) => {
+ page.on('pageerror', (exception) => expect(exception).toBeNull())
+ await page.goto('bulletin-board#events')
+ const demo = page.locator('#events')
+ const modal = page.locator('.tiny-modal')
+
+ await demo.getByRole('link', { name: 'TINY v2.1.3 版本' }).click()
+ await expect(modal.getByText('click 事件:内容为TINY v2.1.3 版本')).toBeVisible()
+})
diff --git a/examples/sites/demos/pc/app/bulletin-board/events.vue b/examples/sites/demos/pc/app/bulletin-board/events.vue
new file mode 100644
index 0000000000..36ed3018d5
--- /dev/null
+++ b/examples/sites/demos/pc/app/bulletin-board/events.vue
@@ -0,0 +1,105 @@
+
+
+
+
+
diff --git a/examples/sites/demos/pc/app/bulletin-board/webdoc/bulletin-board.js b/examples/sites/demos/pc/app/bulletin-board/webdoc/bulletin-board.js
index cd4475d93e..a03a2c84db 100644
--- a/examples/sites/demos/pc/app/bulletin-board/webdoc/bulletin-board.js
+++ b/examples/sites/demos/pc/app/bulletin-board/webdoc/bulletin-board.js
@@ -104,6 +104,18 @@ export default {
'en-US': 'You can use icon
to customize the new bulletin prefix icon.
\n'
},
codeFiles: ['icon.vue']
+ },
+ {
+ demoId: 'events',
+ name: {
+ 'zh-CN': '事件',
+ 'en-US': 'Fold panel click event'
+ },
+ desc: {
+ 'zh-CN': '当点击内容后会触发 contentClick
事件。
',
+ 'en-US': 'When clicked, it will trigger contentClick
.
'
+ },
+ codeFiles: ['events.vue']
}
]
}
diff --git a/packages/renderless/src/bulletin-board/index.ts b/packages/renderless/src/bulletin-board/index.ts
index 0e20f133b9..5856e77e24 100644
--- a/packages/renderless/src/bulletin-board/index.ts
+++ b/packages/renderless/src/bulletin-board/index.ts
@@ -34,3 +34,9 @@ export const computedMoreLink =
}
return props.moreLink
}
+
+export const handleBulletinBoardClick =
+ ({ emit }) =>
+ (item) => {
+ emit('contentClick', item)
+ }
diff --git a/packages/renderless/src/bulletin-board/vue.ts b/packages/renderless/src/bulletin-board/vue.ts
index f95032afbb..4581d395da 100644
--- a/packages/renderless/src/bulletin-board/vue.ts
+++ b/packages/renderless/src/bulletin-board/vue.ts
@@ -10,11 +10,11 @@
*
*/
-import { getRoute, computedDataList, computedMoreLink } from './index'
+import { getRoute, computedDataList, computedMoreLink, handleBulletinBoardClick } from './index'
-export const api = ['state', 'getRoute']
+export const api = ['state', 'getRoute', 'handleBulletinBoardClick']
-export const renderless = (props, { reactive, computed, watch }) => {
+export const renderless = (props, { reactive, computed, watch }, { emit }) => {
const api = {}
const state = reactive({
actName: props.activeName,
@@ -34,7 +34,8 @@ export const renderless = (props, { reactive, computed, watch }) => {
state,
getRoute,
computedDataList: computedDataList({ props, state }),
- computedMoreLink: computedMoreLink({ props })
+ computedMoreLink: computedMoreLink({ props }),
+ handleBulletinBoardClick: handleBulletinBoardClick({ emit })
})
return api
diff --git a/packages/theme/src/bulletin-board/index.less b/packages/theme/src/bulletin-board/index.less
index 1543487d23..708252a209 100644
--- a/packages/theme/src/bulletin-board/index.less
+++ b/packages/theme/src/bulletin-board/index.less
@@ -31,6 +31,7 @@
white-space: normal;
line-height: initial;
font-weight: var(--tv-BulletinBoard-item-title-font-weight);
+ cursor: pointer;
&,
&:hover {
diff --git a/packages/vue/src/bulletin-board/src/pc.vue b/packages/vue/src/bulletin-board/src/pc.vue
index 7bb38f86d1..5ad11f2581 100644
--- a/packages/vue/src/bulletin-board/src/pc.vue
+++ b/packages/vue/src/bulletin-board/src/pc.vue
@@ -25,13 +25,14 @@
:target="subItem.target"
class="tiny-bulletin-board__textTitle"
rel="noopener noreferrer"
+ @click="handleBulletinBoardClick(subItem)"
>
{{ subItem.text }}
{{ icon ? '' : 'NEW' }}
-