npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hotspot-vue3

v1.0.1

Published

A hot zone generation tool for VUE3 + TS projects

Downloads

26

Readme

hotspot-vue3 · npm yarn github

A hot zone generation tool for VUE3 + TS projects 中文文档

image

Try out the demo!

Plug-in installation

yarn add hotspot-vue3

# or

npm install hotspot-vue3 --save

The plug-in USES

  • Introduced in the business component file
import Hotspot from "hotspot-vue3";
  • In your business code, use it as a normal component
<template>
  <div class="hotapp">
    <hotspot
      :image="image"
      :zonesInit="zones"
      :types="types"
      :minSize="52"
      :switchOptions="{
        isShowSign: true,
        isShowDelete: true,
        isOverlap: false,
        isShowActive: true
      }"
      :styleOptions="{}"
      @add="handleAdd"
    >
      <!-- <template #sign="{ zone, index }">
        {{ zone }}
        {{ index }}
      </template>
      <template #delete="{ index }">
        {{ index }}
      </template> -->
    </hotspot>
    <div class="hotapp__display">
      <button type="primary" @click="handleAdd">Add hot spots</button>
      <input
        type="text"
        v-for="(zone, index) in zones"
        :key="index"
        v-model="zone.url"
        :placeholder="`Area ${index + 1} url`"
      />
    </div>
  </div>
</template>

<script lang="ts">
import { Options, Vue } from "vue-class-component";
import Hotspot from "hotspot-vue3";

type MoreUrl = {
  [key in string | number]: string;
};
interface ZoneType {
  topPer: number;
  leftPer: number;
  widthPer: number;
  heightPer: number;
  url?: string | MoreUrl;
  active?: boolean;
  key?: string;
}

@Options({
  components: {
    Hotspot
  }
})
export default class App extends Vue {
  // image url
  image =
    "https://github.com/shadow-Fiend/readme_image/blob/master/big_fish.jpeg";
  zones = [] as ZoneType[];
  types = "move";

  handleAdd(zon: ZoneType) {
    let zone: ZoneType;
    if (zon.topPer) {
      // If this parameter exists, drag to create a hot zone
      zone = zon;
      zone.url = "https://github.com";
      this.types = "move"; // When Max hot zones exist, verify by dragging or clicking to Max
    } else {
      // Create hot zones with buttons
      zone = {
        heightPer: 0.2027, //20.27%
        leftPer: 0.2027,
        topPer: 0.2027,
        widthPer: 0.1027,
        url: "https://github.com",
        key: String(Math.random())
      } as ZoneType;
      this.types = "btn"; // When Max hot zones exist, verify by dragging or clicking to Max
    }
    this.zones.push(zone); // Hotspot data
  }
}
</script>

<style lang="scss" scoped>
.hotapp {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 555px;
  min-width: 1000px;

  &__display {
    margin-top: 24px;

    > input {
      margin-left: 10px;
    }
  }
}
</style>

Parameters that

As shown in the sample code, import this component directly, and control all other functions through properties.

Here's what each property means:

Hotspot Attributes

| Attribute | Description | Type | Accepted Values | Default | | :------------ | :------------------------------------------------------------------------------------------------------------------------------ | :----: | :--------------------------------------------------------------------------: | :-----: | | image | Url address of heat base map | String | | | | zonesInit | Hot zone content, in array form | Array | topPer、leftPer、widthPer、heightPer、url、active、key | | | max | That is, the maximum number of displays in the current hot zone. If you do not set this parameter, it can be added indefinitely | Number | | | | types | The way to add hot areas | String | move: Generated by dragging the mouse, btn: Generated by custom button click | | | switchOptions | Hot zone switch properties | Object | isShowSign、isShowDelete、isOverlap、isShowActive | | | styleOptions | Hot zones display some color value properties | Object | zoneBorderColor、zoneBgColor、zoneActiveBgColor | |

ZonesInit Atributes

| Attribute | Description | Type | Accepted Values | Default | | :-------- | :---------------------------------------------------------------------------- | :-----------------: | :-------------: | :---------------: | | topPer | Distance from the top as a percentage of the total area | Number | | | | leftPer | Distance to the left as a percentage of the total area | Number | | | | widthPer | Percentage of hot zone width in total area | Number | | | | heightPer | Percentage of hot zone height to total area | Number | | | | url | Hot area link address, you can define your own object to save more parameters | String / any | | | | active | Hot zone activation state | Boolean / undefined | | false / undefined | | key | Hot zone key, used for unique identification | String | | Math.random() |

SwitchOptions Atributes

| Attribute | Description | Type | Accepted Values | Default | | :----------- | :---------------------------------------------------------- | :-----: | :-------------: | :-----: | | isShowSign | Whether to display hot zone signs | Boolean | | true | | isShowDelete | Whether to display the hot zone deletion sign | Boolean | | true | | isOverlap | Whether coverage is allowed between hot zones | Boolean | | false | | isShowActive | Click the hot zone to see if the active status is displayed | Boolean | | true |

StyleOptions Atributes

| Attribute | Description | Type | Accepted Values | Default | | :---------------- | :------------------------------------------------------------------------------------------------ | :----: | :-------------: | :---------------------: | | zoneBorderColor | Hot zone border color | String | | #507bfb | | zoneBgColor | Hot area background color | String | | rgba(80, 123, 251, 0.1) | | zoneActiveBgColor | Hot zone background color in active state. This color takes effect only when isShowActive is true | String | | rgba(80, 123, 251, 0.4) |

Write in the last

At this point, all the ways to use the plug-in are covered.

This plugin only supports vue3.x projects...

For more information about the source of the plugin, please visit the GitHub plugin repository:hotspot-vue3