html页面
<meta name="viewport" content="width=device-width, initial-scale=0, user-scalable=yes,shrink-to-fit=no">
vue 在public里面的index.html里面设置
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
Nuxt3 在nuxt.config.ts里面加入app那个对象
export default defineNuxtConfig({devtools: { enabled: true },// 兼容手机端app: {head: {charset: "utf-8",viewport: "width=device-width,initial-scale=1",title: "这里是页面title",meta: [{name: "viewport",content: "width=device-width, initial-scale=0, user-scalable=yes,shrink-to-fit=no",},{name: "description",content: "这里是网站描述",},{name: "Keywords",content: "这是是关键词",},],// 设置网站iconlink: [{ rel: "icon", href: "", type: "png/jpg/image/x-icon" }],},},
})
核心:
{name: "viewport",content: "width=device-width, initial-scale=0, user-scalable=yes,shrink-to-fit=no",
},
电脑端
手机端