|
|
@@ -171,17 +171,22 @@
|
|
|
export default {
|
|
|
layout: "opacity_header",
|
|
|
async asyncData({ $axios, params, req, app }) {
|
|
|
- console.log("********req********", req)
|
|
|
- const { headers: { host } = {}, url } = req || {}
|
|
|
- //拼接canonical
|
|
|
- let canonical = ""
|
|
|
- if (host.indexOf('local') !== -1) {
|
|
|
- canonical = 'http://' + host + url
|
|
|
- } else {
|
|
|
- canonical = 'https://' + host + url
|
|
|
+ if (process.server) {
|
|
|
+ const { headers: { host } = {}, url } = req || {}
|
|
|
+ //拼接canonical
|
|
|
+ let canonical = ""
|
|
|
+ if (host.indexOf('local') !== -1) {
|
|
|
+ canonical = 'http://' + host + url
|
|
|
+ } else {
|
|
|
+ canonical = 'https://' + host + url
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ nowUrl: canonical,
|
|
|
+ mobile: app.$deviceType.isMobile()
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return {
|
|
|
- nowUrl: canonical,
|
|
|
mobile: app.$deviceType.isMobile()
|
|
|
}
|
|
|
},
|