vue与axios结合输出多个json
<!DOCTYPE html>
<html lang="en" xmlns:v-binf="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!--v-cloak 解决闪烁问题-->
<style>
[v-cloak]{
display: none;
}
</style>
</head>
<body>
<div id="message">
<ul>
<li v-for="item in info.address">{{item.name}}---{{item.address}}</li>
</ul>
</div>
</body>
</html>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript">
var vm=new Vue({
el: "#message",
data() {
return {
info: {
}
}
},
mounted() {
axios.get('test1.json').then(response => (this.info = response.data))
}
})
</script>
<!--引入js文件-->

浙公网安备 33010602011771号