vue组件
引入vue.js
渲染区
js代码
axios技术
模拟JSON串上传
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../../vue/vue.js"></script>
<script src="../../vue/axios.min.js"></script>
</head>
<body>
<div id="app">
<button @click="welcome()">欢迎</button>
来自{{addr}} 的 {{name}}同学
</div>
<script>
new Vue({
el:'#app',
data:{
'name':'',
'addr':''
},
methods:{
welcome(){
axios.get('json.json').then(
res => {
console.log(res.data.name);
console.log(res.data.addr);
this.name = res.data.name;
this.addr = res.data.addr
}
)
}
}
})
</script>
</body>
</html