djangoとvueのgetとpost
いつも忘れて検索するのでメモ。
views.py
class HogeAPI(APIView):
def get(self, request):
dict = request.GET.dict()
return JsonResponse(dict, safe=False)
def post(self, request):
dict = json.loads(request.body)
return JsonResponse(dict, safe=False)
hoge.vue
get: async(context, payload) => {
const response = await $axios.$get('/api/hoge/', {params: payload});
console.log(response)
},
post: async(context, payload) => {
const response = await $axios.$post('/api/hoge/', payload);
console.log(response)
},
Author And Source
この問題について(djangoとvueのgetとpost), 我々は、より多くの情報をここで見つけました https://qiita.com/popo62520908/items/7a1d23eb5cd3de688f15著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .