Я пытаюсь использовать ax ios и роутер одновременно с использованием CDN, поэтому у меня есть следующие коды, которые выдают ошибку при попытке запустить мою веб-страницу, я искал весь день, но Я не смогу с этим справиться, я был бы признателен, если у кого-то есть идея.
<script src="https://npmcdn.com/vue-router/dist/vue-router.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
listHotels: {},
hotel: {
name: '',
price: 0,
location: ''
}
}
},
methods: {
getHotels() {
axios.get('/database.json')
.then(res => {
this.listHotels = res.data.hotels.data;
});
},
addHotel() {
if (this.hotel.name === '' || this.hotel.price <= 0 || this.hotel.location === '') {
return alert('BOOOO ERROR');
}
const data = { ...this.hotel };
axios.post('/hotels.php', data)
.then(res => {
console.log(res.data);
this.getHotels();
});
this.hotel.name = '';
this.hotel.price = 0;
this.hotel.location = '';
}
},
created() {
this.getHotels();
}
});
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }
const routes = [
{ path: '/foo', component: Foo },
{ path: '/bar', component: Bar }
]
const router = new VueRouter({
routes // raccourci pour `routes: routes`
})
const app = new Vue({
router
}).$mount('#app')
</script>
У меня ошибка:
A cookie associated with a cross-site resource at http://cloudflare.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
Кроме того, когда я удаляю один из этих кодов, топор ios или маршрут, тогда все работает.