如何在 HTML Meteor 中检查移动/网络? [英] How to Check Mobile/Web in HTML Meteor?

查看:26
本文介绍了如何在 HTML Meteor 中检查移动/网络?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 HTML Meteor 中检查 Mobile/Web 以加载 UI?.

How to check Mobile/Web in HTML Meteor for loading UI? .

if mobile //here how to check if it is mobile or web
{
   {{>template}}// mobile body
}
else
{
  {{>template}}//web body
}

我是 Meteor 的新手.所以请建议我该怎么做?

I am new to Meteor. So please suggest me what to do?

推荐答案

您可以使用 device-检测包.

首先,通过以下方式安装:

First, install it via:

meteor add mystor:device-detection

然后您可以使用提供的辅助方法,如 Meteor.Device.isPhone(),或直接从空格键:{{#if isPhone}}Phone{{/if}}.有关详细信息,请参阅 Github 上的自述文件.

Then you can use the provided helper methods like Meteor.Device.isPhone(), or directly from Spacebars: {{#if isPhone}}Phone{{/if}}. See the readme on Github for details.

这篇关于如何在 HTML Meteor 中检查移动/网络?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆