JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q49449F
  • License MIT

Hotspot component for Vue.js.

Package Exports

  • vue-hotspot

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-hotspot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vue travis-ci Coverage Status npm License GitHub code size in bytes Version

English | 简体中文

Introduction

Vue-Hotspot is an image hotspot component for Vue.js.

Installation

$ npm install vue-hotspot --save

yarn

$ yarn add vue-hotspot

Usage

ES Modules with npm (Recommended)

import Vue from 'vue'
import VueHotspot from 'vue-hotspot' // refers to components/VueHotspot.vue in webpack

// register component to use
Vue.component('v-hotspot', VueHotspot)

Global variable

Without any module system, the component is exposed as window.VueHotspot.

// register component to use
Vue.component('v-hotspot', VueHotspot)

Using the component

<template>
  <v-hotspot
    :init-options="hotspotConfig"
    @save-data="saveData"
    @after-delete="afterDelete" />
</template>

<script>
import Vue from 'vue'
import VueHotspot from 'vue-hotspot'
export default {
  components: {
    'v-hotspot': VueHotspot
  },
  data () {
    return {
      hotspotConfig: {
        image: 'your-image-url.png',
        editable: true,
        interactivity: 'hover',
        data: [
          { Message: 'A prepopulated hotspot', Title: 'Vue Hotspot 1', x: 33.3, y: 58.33 },
          { Message: 'Another prepopulated hotspot', Title: 'Vue Hotspot 2', x: 53.3, y: 78.3 }
        ],
        hotspotColor: '#85ce61',
        messageBoxColor: '#409eff',
        textColor: '#333',
        opacity: 0.9
      }
    }
  },
  methods: {
    saveData (data) {
      // Do something with the list of hotspots
      console.log(data)
    },
    afterDelete () {
      // Do something after delete
      console.log('Do something after delete ...')
    }
  }
}
</script>

Live Demo

You can see more examples here.

Config Options

description required default
image Default image placeholder true an empty image with text 'Oops! image not found...'
data Object to hold the hotspot data points.
Data structure: [ {Message: 'String', Title: 'String, x: Float, y: Float'} ]
false []
editable Specify editable in which the plugin is to be used.
true: Allows to create hotspots from UI.
false: Display hotspots from data object
false true
interactivity Event on which the hotspot data point will show up.
allowed values: click, hover, none
false hover
hotspotColor background color for hotspots false 'rgb(66, 184, 131)'
messageBoxColor background color for hotspot message boxes false 'rgb(66, 184, 131)'
textColor background color for hotspot text false 'rgb(66, 184, 131)'
opacity opacity for hotspots false 0.8

Local development

$ npm i
$ npm run serve

Open http://localhost:8080/ to see the demo. 1.10-1.21