uniapp 修改meta:viewport
onLoad(options) {
this.setViewport(`width=device-width, initial-scale=1.0`);
},
onUnload() {
this.setViewport(`width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover`);
},
methods: {
setViewport(content) {
const meta = document.querySelector('meta[name=viewport]');
if (!meta) return;
meta.setAttribute('content', content);
}
},