nuxt 通过服务端检测设备类型 判断PC 还是 移动端
npm install nuxt-user-agent
// nuxt.config.js
modules: [
'nuxt-user-agent',
]
async asyncData({ $indexApi, store, route, $baseConfigId, $accessKey, $ua }) {
let equipment = ''
if ($ua._parsed.category === 'pc') {
equipment = 'pc'
} else {
equipment = 'h5'
}