vuepress-plugin-last-reading

1.0.0 • Public • Published

vuepress-plugin-last-reading

A vuepress plugin to record the last reading

Documentation

Installation

yarn add vuepress-plugin-last-reading
# or 
npm i vuepress-plugin-last-reading

Usage

module.exports = {
  plugins: [
    'last-reading'
  ]
}

Options

popupConfig

  • Type: Object
  • Required: false

The default content displayed in the popup component.

module.exports = {
  plugins: [
    ['last-reading', {
      popupConfig: {
        message: 'Go back',
        buttonText: 'ok'
      },
    }]
  ]
}

Or refer to i18n

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.

popupCustom

  • Type: Object
  • Required: false

Custom popup related logic.

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

Package Sidebar

Install

npm i vuepress-plugin-last-reading

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

7.7 kB

Total Files

9

Last publish

Collaborators

  • tolking