首页 > 其他分享 >vue.js代码024

vue.js代码024

时间:2023-02-25 12:03:12浏览次数:51  
标签:el vue name js 024 点击 Vue 跳转 event


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>事件绑定</title>
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div id="root">
<h2>{{name}}</h2>
<a href="http://www.baidu.com" @click="showInfo($event)">点击我,阻止跳转百度</a>
</div>
<script type="text/javascript">
Vue.config.productionTip = false;

const vm = new Vue({
el:'#root',
data:{
name:'虾米大王'
},
methods:{
showInfo(event){

alert('点击了我,显示提示');
event.preventDefault();
}
}
})


</script>
</body>
</html>

标签:el,vue,name,js,024,点击,Vue,跳转,event
From: https://blog.51cto.com/u_15356972/6085196

相关文章

  • vue.js代码023
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>事件绑定</title><scripttype="text/javascript"src="../js/vue.js"></script></head>......
  • vue.js代码019
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码018
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码020
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码015
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码013
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码017
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码012
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码014
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......
  • vue.js代码016
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><scripttype="text/javascript"src="../js/vue.js"></script></head><......