JSPM

@phantasweng/vue-cryptocurrency-icons

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q28979F
  • License CC0-1.0

cryptocurrency icon component for vue3

Package Exports

  • @phantasweng/vue-cryptocurrency-icons
  • @phantasweng/vue-cryptocurrency-icons/dist/index.esm.js

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 (@phantasweng/vue-cryptocurrency-icons) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vue Cryptocurrency Icons

Inheriting image resources from cryptocurrency-icons and writing a version that can be used in Vue 3.

The biggest difference is that the original cryptocurrency-icons need to import images directly from node_module, for example:

import avax from './node_modules/cryptocurrency-icons/svg/color/avax.svg'.

But in tools like Vite, it is not easy to import images directly from node_module. It requires some other configurations.

Install πŸš€

$ npm install @phantasweng/vue-cryptocurrency-icons

Vue Global on main.js

import VueCryptocurrencyIcons from '@phantasweng/vue-cryptocurrency-icons'

app.use(VueCryptocurrencyIcons)

Component

<VueCryptocurrencyIcons name="Avax" />

Props

Prop Options Default Description
name btc, eth, sol, usdc...etc null Please refer to the list of currency names in manifest.json.
type svg, png svg Image Type
size 32, 2x, 128, number (when type is png) default is 32 when type is svg Ignore when using svg. Please customize width and height with style.
theme color black,color, white icon color

Methods

icons

取得 icons list

import { icons } from '@phantasweng/vue-cryptocurrency-icons'
console.log(icons)

/**
 * [
 * 	{symbol: '$PAC', name: 'PACcoin', color: '#f5eb16'},
 *  ...
 * ]
*/

getIcon

Manually get the icon's base64

import { getIcon } from '@phantasweng/vue-cryptocurrency-icons'
getIcon({
  name: 'btc',
  type: 'svg',
  size: '32',
  theme: 'white',
}).then((res) => {
  console.log(res)
})
console.log(myIcon)
// {default: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org….45c.975.243 4.118.696 3.61 2.733z'/%3e%3c/svg%3e"}