axios:
axios.get("http://localhost:7000/user/spanname").then(ref=>{
header1.msg="欢迎回来:"+ref.data.name;
alert(ref.uid)
ajax:
$.get("http://localhost:7000/user/spanname",{},function (data) {
var msg="欢迎回来,"+data.name;
$("#spanname").html(msg);
记录踩的一个坑,在获取的返回的数据时,axios要加上.data才是json内容
<form id="form" @submit="checkForm" action="" method="post">
// 提交测试
checkForm: function (e) {
// 进行验证 验证通过就返回 true
if(clickValidate("form")){
return true;
};
e.preventDefault();
},
Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
<script type="text/javascript">
//图片点击事件
function changeCheckCode(img) {
img.src = "http://localhost:7000/checkCode?" + new Date().getTime();
}
</script>
原因是vue组件没办法渲染这一块
login1.imgurl= "http://localhost:7000/checkCode?" + new Date().getTime();
注意在方法中修改data的值要加上vue的名称
注意兄弟组件传值的注册中心要定义在组件前面