svelte device detector
0.2.2
• •
Memberikan tampilan pada jenis perangkat yang berbeda.
npm i svelte-device-detector
// OR
yarn add svelte-device-detector
Catatan: Untuk menggunakan pustaka ini di Sapper, instal sebagai DevDependency. Lihat tautannya.
Demo lokal:
git clone https://github.com/andrelmlins/svelte-device-detector.git
cd svelte-device-detector
npm install && npm run dev
Contoh cara menggunakan perpustakaan:
< script >
import DeviceDetector from "svelte-device-detector";
</ script >
< DeviceDetector showInDevice = "desktop" >
< p > Desktop </ p >
< / DeviceDetector>
< DeviceDetector showInBrowser = "chrome" showInDevice = "mobile" >
< p > Mobile and Chrome </ p >
</ DeviceDetector >
< DeviceDetector showInBrowser = { [ "safari" , "firefox" ] } >
< p > Safari or Firefox </ p >
< / DeviceDetector>Untuk hasil terbaik, nilai -nilai memiliki karakteristik ini:
| Menopang | Bawaan | Jenis | Keterangan |
|---|---|---|---|
| Showindevice | - | string , array | Render tampilan pada jenis perangkat |
| showinbrowser | - | string , array | Render tampilan pada jenis browser |
| showinos | - | string , array | Render tampilan tentang jenis sistem operasional |
Unduh statistik untuk paket NPM ini
Detektor perangkat SVELTE adalah perangkat lunak open source yang dilisensikan sebagai MIT.