Search Docs
为了省钱,省服务器,一个链接访问页面,想同时适配PC端和移动端
在js中识别当前设备,需要使用userAgent
console.log(navidator.userAgent) // 正则判断 function isMobile(){ return /Mobi|Android/i.test(navigator.userAgent) } if(isMobile()){ // 比如说在Vue中,通过provide中透传是否是手机端这个值,后代组件中根据不同的值显示不同的组件 // 或者是加载不同的css }
媒体查询、flex