Skip to content

Commit 5d3aa30

Browse files
authored
Merge pull request #349 from devforth/AdminForth/829
docs: update docs for the page injection
2 parents cfa7731 + db1b013 commit 5d3aa30

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

adminforth/documentation/docs/tutorial/03-Customization/08-pageInjections.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Now create file `CheckReadingTime.vue` in the `custom` folder of your project:
277277
```html title="./custom/CheckReadingTime.vue"
278278
<template>
279279
<div class="text-gray-500 text-sm">
280-
<div @click="checkReadingTime" class="cursor-pointer flex gap-2 items-center">
280+
<div class="cursor-pointer flex gap-2 items-center">
281281
Check reading time
282282
</div>
283283
</div>
@@ -287,6 +287,10 @@ Now create file `CheckReadingTime.vue` in the `custom` folder of your project:
287287
import { getReadingTime} from "text-analyzer";
288288
import adminforth from '@/adminforth';
289289
290+
defineExpose({
291+
click,
292+
});
293+
290294
function checkReadingTime() {
291295
const text = document.querySelector('[data-af-column="description"]')?.innerText;
292296
if (text) {
@@ -298,6 +302,11 @@ function checkReadingTime() {
298302
}
299303
adminforth.list.closeThreeDotsDropdown();
300304
}
305+
306+
function click() {
307+
checkReadingTime();
308+
}
309+
301310
</script>
302311
```
303312
@@ -312,6 +321,7 @@ npm i text-analyzer
312321
313322
> ☝️ Please note that we are using AdminForth [Frontend API](/docs/api/FrontendAPI/interfaces/FrontendAPIInterface/) `adminforth.list.closeThreeDotsDropdown();` to close the dropdown after the item is clicked.
314323
324+
>☝️ Please note that the injected component might have an exposed click function as well as a defined click function, which executes the click on component logic.
315325
316326
## List table custom action icons
317327

0 commit comments

Comments
 (0)