https://github.com/tolking/vuepress-plugin-last-reading
A vuepress plugin to record the last reading
https://github.com/tolking/vuepress-plugin-last-reading
history last-reading reading vuepress vuepress-plugin
Last synced: 9 months ago
JSON representation
A vuepress plugin to record the last reading
- Host: GitHub
- URL: https://github.com/tolking/vuepress-plugin-last-reading
- Owner: tolking
- License: mit
- Created: 2020-10-08T09:08:25.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2020-10-15T12:34:01.000Z (about 5 years ago)
- Last Synced: 2024-04-26T16:46:03.901Z (over 1 year ago)
- Topics: history, last-reading, reading, vuepress, vuepress-plugin
- Language: Vue
- Homepage: https://tolking.github.io/vuepress-plugin-last-reading/
- Size: 486 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vuepress-plugin-last-reading
> A vuepress plugin to record the last reading
[Documentation](https://tolking.github.io/vuepress-plugin-last-reading/)
## Installation
``` sh
yarn add vuepress-plugin-last-reading
# or
npm i vuepress-plugin-last-reading
```
## Usage
``` js
module.exports = {
plugins: [
'last-reading'
]
}
```
## Options
### popupConfig
- Type: `Object`
- Required: `false`
The default content displayed in the popup component.
``` js
module.exports = {
plugins: [
['last-reading', {
popupConfig: {
message: 'Go back',
buttonText: 'ok'
},
}]
]
}
```
Or refer to [i18n](./src/i18n.js)
### popupCountdown
- Type: `Number`
- Default: `10000`
- Required: `false`
Configure the time that the popup will display.
### popupComponent
- Type: `string`
- Required: `false`
A custom component to replace the default popup component, refer to [Customize the UI of Popup](https://tolking.github.io/vuepress-plugin-last-reading/#customize-the-ui-of-popup).
### popupCustom
- Type: `Function`
- Required: `false`
Custom popup related logic.
``` js
module.exports = {
plugins: [
['last-reading', {
popupCustom: function() {
const now = new Date().getTime()
if (now - this.lastReading.timestamp > 30 * 24 * 60 *60 * 1000) {
this.clean()
} else if (this.$route.path === this.lastReading.path) {
this.goto()
} else {
this.show = true
setTimeout(this.clean, 10000)
}
},
}]
]
}
```
## License
[MIT](http://opensource.org/licenses/MIT)