Nuxt.js写H5移动端项目中,禁止屏幕放大和缩小
1.在Nuxt.config.js中配置如下代码
head: {
title: 'xxx',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0' },
{ hid: 'description', name: 'description', content: 'xxx' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
起作用的是粗体部分:maximum-scale=1.0, user-scalable=0'
其他meta属性都可以在这里配置。