问题
Let's say I have a function that runs fetch()
to send an asynchronous GET
request that returns a response with the following payload:
<script type="text/javascript">
var csrfToken = "ImJmMWIxZjI0ZGRmMTA1ZGVkYWQ5NThlNThlYjM3OTYzYmRhNmRiMDAiU"
</script>
How can I access the csrfToken
variable in Vue?
When I access the response body it converts that whole body into a giant string rather than running the JS and making the variable available for use.
来源:https://stackoverflow.com/questions/65499966/how-can-i-get-data-from-a-response-payload-script