@vladimir Вы можете использовать axios библиотеку чтобы сделать Ajax запрос в Vue.js, ниже пример кода как пример:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<template> <div class="container"> <h1>Test Component</h1> <button @click="sendAjax">Сделать ajax запрос</button> </div> </template> <script> import axios from 'axios' export default { name: 'Test', methods: { sendAjax() { axios .get('https://httpbin.org/get') .then((response) => { console.log(response.data) }) .catch((e) => { console.log(`Ошибка: ${e}`) }) }, }, } </script> |