Coder Social home page Coder Social logo

amap-weather-icons's Introduction

amap-weather-icons

standard-readme compliant

Background

由于高德地图 天气查询 API 并没有返回相应的 天气现象 图标,故编写此库方便大家使用。本项目采用 Web Components 编写,支持主流的前端技术框架,感谢 林间风雨 提供的图片资源。

Install

npm install amap-weather-icons

Usage

Web Components

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>amap-weather-icons</title>
    <script src="https://unpkg.com/[email protected]/output/index.js"></script>
  </head>
  <body>
    <amap-weather-icons size="50" icon="暴雪"></amap-weather-icons>
  </body>
</html>

Vite

// vite.config.js
import vue from '@vitejs/plugin-vue'

export default {
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag.includes('amap-weather-icons')
        }
      }
    })
  ]
}

Vue

<script setup>
import "amap-weather-icons";
import { ref } from "vue";

const size = ref(50);
const icon = ref("暴雪");
</script>

<template>
  <amap-weather-icons :icon="icon" :size="size"></amap-weather-icons>
</template>

React

import "amap-weather-icons";
import { useState } from "react";

function App() {
  const [size] = useState(50);
  const [icon] = useState("暴雪");

  return (
    <>
      <amap-weather-icons size={size} icon={icon}></amap-weather-icons>
    </>
  );
}

export default App;

Svelte

<script>
  import "amap-weather-icons";

  const size = 50;
  const icon = "暴雪";
</script>

<main>
  <amap-weather-icons {size} {icon}></amap-weather-icons>
</main>

Attributes

Name Description Type Default
icon weather phenomena string 未知
size SVG width/height px string/number 256

License

MIT

amap-weather-icons's People

Contributors

rofixro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.