开源: react 天气组件 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
douyacun
V2EX    React

开源: react 天气组件

  •  1
     
  •   douyacun
    douyacun 2021-01-15 10:03:35 +08:00 1829 次点击
    这是一个创建于 1810 天前的主题,其中的信息可能已经有所发展或是发生改变。

    npm npm npm echarts supported react supported

    体验地址:

    https://www.douyacun.com

    文档:

    https://www.douyacun.com/article/b9093956c565e471f45c035b5870ed0c

    特点:

    1. 使用腾讯天气接口: https://wis.qq.com/weather/common?source=pc&weather_type=forecast_1h|forecast_24h|alarm|limit|tips|rise|observe|index&province=${province}&city=${city}&county=
    2. 支持:逐小时预报 /7 日天气预报 /生活指数
    3. 支持 IP 定位,使用免费 IP 定位接口
    4. 支持服务端渲染

    react 腾讯天气组件 react 腾讯天气组件

    install

    npm install tencent_weather --save 

    运行 demo:

    git clone [email protected]:hustcc/echarts-for-react.git npm install npm start 

    本地浏览器打开 http://127.0.0.1:3000

    usage

    客户端使用

    import React from 'react'; import ReactDOM from 'react-dom'; import Weather from 'react-tencent-weather'; ReactDOM.render( <div><Weather province="上海" city="上海" /></div>, document.getElementById('root') ) 

    服务端渲染

    import React from 'react'; import ReactDOM from 'react-dom'; import Weather from 'react-tencent-weather/lib/ssr/index.js'; import 'react-tencent-weather/lib/ssr/index.css'; ReactDOM.render( <div><Weather province="上海" city="上海" /></div>, document.getElementById('root') ) 

    component props

    • province: (optional, string)

    省份,默认上海

    • city: (optional, string)

    城市,默认上海

    • showDays : (optional, bool)

    是否显示 7 日天气预报

    • showHours: (optional, bool)

    是否显示 逐小时预报

    • showLiving: (optional, bool)

    是否显示 生活指数

    • showTomorrow: (optional, bool)

    是否显示明日预报

    LICENSE

    MIT@douyacun.

    关注微信公众号

    douyacun

    3 条回复    2021-01-15 10:21:38 +08:00
    douyacun
        1
    douyacun  
    OP
       2021-01-15 10:06:01 +08:00
    目前是第一版,长期维护
    tokyo2020
        2
    tokyo2020  
       2021-01-15 10:16:33 +08:00
    这博客网站很 google 风格呀, 这叫什么啊,我可以学下吗,
    douyacun
        3
    douyacun  
    OP
       2021-01-15 10:21:38 +08:00
    @tokyo2020
    组件库: https://material-ui.com/ 实现的是 google https://material.io/design
    react 库: https://nextjs.org/ 服务端渲染
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     4868 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 45ms UTC 03:57 PVG 11:57 LAX 19:57 JFK 22:57
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86