Created
December 21, 2016 07:19
-
-
Save edwardkenfox/257709d51e1b4e4bcce8f60f9e0307f7 to your computer and use it in GitHub Desktop.
20161221_s3_cors_test.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html class="no-js" lang=""> | |
<head> | |
<script src="https://unpkg.com/vue/dist/vue.js"></script> | |
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |
</head> | |
<body> | |
<div id="app"> | |
<button @click="getAndExecuteFile">Get {{filename}}</button> | |
<br> | |
<span> {{image}} </span> | |
</div> | |
</body> | |
<script type="text/javascript"> | |
window.vm = new Vue({ | |
el: "#app", | |
data: { | |
filename: "https://s3-ap-northeast-1.amazonaws.com/edwardkenfox-tmp/alert.js", | |
image: null | |
}, | |
methods: { | |
getAndExecuteFile: function() { | |
axios.get(this.filename) | |
.then((response) => { | |
this.image = response.data; | |
}) | |
.catch((error) => { | |
console.warn(error); | |
}); | |
} | |
} | |
}) | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment