1.0.7 • Published 12 months ago

vue-hotspot-pro v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

English | 简体中文

Introduction

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

Installation

npm (Recommended)

$ npm install vue-hotspot-pro --save

yarn

$ yarn add vue-hotspot-pro

Usage

ES Modules with npm (Recommended)

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

Using the component

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

<script>
import Vue from 'vue'
import VueHotspotPro from 'vue-hotspot-pro'
export default {
  components: {
    'v-hotspot': VueHotspotPro
  },
  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, width: 9, height: 9, hotspotColor: '#85ce61' },
          { Message: 'Another prepopulated hotspot', Title: 'Vue Hotspot 2', x: 53.3, y: 78.3, width: 9, height: 9, 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>

Project Structure

Project Structure

Config Options

optionsdescriptionrequireddefault
imageDefault image placeholdertruean empty image with text 'Oops! image not found...'
dataObject to hold the hotspot data points.Data structure: [ {Message: 'String', Title: 'String, x: Float, y: Float', hotspotColor: 'RGB' } ]false[]
editableSpecify editable in which the plugin is to be used.true: Allows to create hotspots from UI.false: Display hotspots from data objectfalsetrue
interactivityEvent on which the hotspot data point will show up.allowed values: click, hover, nonefalsehover
~~hotspotColorbackground color for hotspot dotsfalse'rgb(66, 184, 131)'~~
messageBoxColorbackground color for hotspot message boxesfalse'rgb(255, 255, 255)'
textColorbackground color for hotspot textfalse'rgb(53, 73, 94)'
opacityopacity for hotspotsfalse0.8
overlayTexttext for overlay in edit modefalse'Please Click The Image To Add Hotspots.'

Local development

$ npm i
$ npm run serve

Open http://localhost:8080/ to see the demo.

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago