javascript - Vue-Router 在谷歌 ADS 中返回 404
问题描述
我在为我的项目设置谷歌广告时遇到了一些问题。我的 vue 路由器在历史模式下工作,当我直接打开任何 URL(例如mysite.com/category/phone
)时,它工作正常。但是在 ads.google.com 中,当我尝试将这些 URL 添加为目标时,它被拒绝了,因为 google 在对这些 URL 的 HTTP 请求中收到错误 404。也许是因为我在 Yii2 模板中使用了 Vue.js 应用程序?此外,我正在接收元标记和一些需要在路由器初始化之前从后端提供的 URL。
Vue.axios.get('/api/meta').then(response => {
const routes = [...defining routes here...];
...
const router = new VueRouter ({
mode: 'history',
routes,
scrollBehavior (to, from, savedPosition) {
return { x: 0, y: 0 };
}
});
const app = new Vue({
template: '',
router,
}).$mount('#app');
});
解决方案
推荐阅读
- javascript - 如何在 GEE 中使用 shapefile 资产作为 AOI?
- c# - 无法修复 SonarCloud 上的 SQL 注入
- reactjs - 删除行时更新单元格背景颜色。(反应表)
- c# - 无法使用 C# 的 selenium Web 驱动程序根据标签名称选择元素
- javascript - 如何以天、小时和分钟显示下一个生日倒计时?
- haskell - Haskell 中真正的非确定性
- python-3.x - 将相似键的字典转换为字典列表(更新)
- java - 如何在 Java 中为 Koin 获取 Android 上下文
- ios - 使用 Nativescript 从 IOS 9 webview 调用外部应用程序
- python - 如何获得尝试:除了:工作而不是无限地进行