su:无法确定您的用户名。_确定您的用户正在使用哪种互联网

su:无法确定您的用户名。

Vue识别网络 (Vue Identify Network)

Identify what kinda internet your users are using!

确定您的用户正在使用哪种互联网!

安装 (Install)

yarn add vue-identify-network

CDN: UNPKG | jsDelivr (available as window.VueIdentifyNetwork)

CDN: UNPKG | jsDelivr (作为window.VueIdentifyNetwork可用)

用法 (Usage)

<template>
  <detected-speed>
    <span slot="unknown">
      REEE! Unable to identify your network type.
    </span>
    <span slot="slow">
      <img src="cat.gif" alt="you got slow internet">
    </span>
    <span slot="fast">
      <video width="400" controls>
        <source src="mov_bbb.mp4" type="video/mp4">
        <source src="mov_bbb.ogg" type="video/ogg">
        Your browser does not support HTML5 video.
      </video>
    </span>
  </detected-speed>
</template>

<script>
import DetectedSpeed from 'vue-identify-network';

export default {
  components: {
    DetectedSpeed,
  },
};
</script>

API (API)

插槽 (Slots)

  • unknown: The slot to show when we are unable to identify network type (navigator.connection.effectiveType === "Unknown")

    unknown :当我们无法识别网络类型时显示的插槽( navigator.connection.effectiveType === "Unknown" )

  • slow: The slot to show when internet is slow (navigator.connection.effectiveType === "2g")

    slow :互联网速度慢时显示的插槽( navigator.connection.effectiveType === "2g" )

  • fast: The slot to show when internet is fast (navigator.connection.effectiveType !== "2g")

    fast :显示互联网何时快速连接的位置( navigator.connection.effectiveType !== "2g" )

道具 (Props)

  • unknownClass: Add your own classes to the div

    unknownClass :将自己的类添加到div

  • slowClass: Add your own classes to the div

    slowClass :将自己的类添加到div

  • fastClass: Add your own classes to the div

    fastClass :将自己的类添加到div

大事记 (Events)

  • network-type<type>: Emitted after network speed is identified, eg:

    network-type<type> :在识别网络速度之后发出,例如:

<detected-speed @network-type="handleNetworkIdentified"></detected-speed>
function handleNetworkIdentified(type) {
  console.log(type);
}

翻译自: https://vuejsexamples.com/identify-what-kinda-internet-your-users-are-using/

su:无法确定您的用户名。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值