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 thediv
unknownClass
:将自己的类添加到div
slowClass
: Add your own classes to thediv
slowClass
:将自己的类添加到div
fastClass
: Add your own classes to thediv
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:无法确定您的用户名。