export default {
name: "App",
mounted() {
console.log("1111", Boolean(this._isMobile()));
if (this._isMobile()) {
// 为true是移动端,跳至移动端页面
console.log("yi移动端");
// this.$router.replace('/m_index')
} else {
// 为false是pc端,跳至pc端页面
console.log("PC端");
// this.$router.replace('/pc_index')
}
},
methods: {
_isMobile() {
let plat = navigator.userAgent.match( // 判断不同端
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
);
return plat;
}
}
};
</script>
03-31