使用单个控制器显示移动视图 [英] Show mobile view using single controller
本文介绍了使用单个控制器显示移动视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
我有一个由MVC开发的网站。它不是响应式设计。所以我用相同的控制器创建了单独的视图。请帮我看看如何在MVC中显示基于设备的移动视图。?
例如,
桌面视图:
Views / Home / Index.cshtml
Views / Home / About.cshtml
手机查看:
意见/首页/手机/ Index.cshtml
观看/主页/手机/ About.cshtml
Hi friends,
I have a website which is developed by MVC. It is not responsive design. So i have created separate view with same controller. Please help me how to show mobile view based on device in MVC.?
For example,
Desktop View:
Views/Home/Index.cshtml
Views/Home/About.cshtml
Mobile View:
Views/Home/Mobile/Index.cshtml
Views/Home/Mobile/About.cshtml
推荐答案
根据这篇文章 [ ^ ],您的移动设备特定视图应位于同一文件夹中,并调用ViewName .Mobile.cshtml
- 即:
- Views / Home / Index.Mobile。 cshtml
- Views / Home / About.Mobile.cshtml
According to this article[^], your mobile-specific views should be in the same folder, and calledViewName.Mobile.cshtml
- ie:
- Views/Home/Index.Mobile.cshtml
- Views/Home/About.Mobile.cshtml
这篇关于使用单个控制器显示移动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文