1 Star 0 Fork 0

yzishan / webs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index3.html 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
yangzishan 提交于 2023-11-22 17:13 . all
<!DOCTYPE html>
<html>
<head>
<title>testzishan</title>
<style type="text/css"></style>
<meta charset="UTF-8">
<script src="./vue.js"></script>
<body>
<div id="app">
<counter ref="one" @change="handletotal"></counter>
<counter ref="two" @change="handletotal"></counter>
综合:{{total}}
</div>
<script>
Vue.component("counter",{
template:"<div @click='handelCounter'>{{content}}</div>",
data(){
return{
content:0
}
},
methods:{
handelCounter(){
this.content++;
this.$emit('change')
}
}
});
let app = new Vue({
el:'#app',
data:{
message: "hello world",
total:0
},
methods:{
handletotal(){
console.log(this.$refs.one)
this.total = this.$refs.one.content+this.$refs.two.content
}
}
});
</script>
</body>
</head>
</html>
1
https://gitee.com/yzishan/webs.git
git@gitee.com:yzishan/webs.git
yzishan
webs
webs
master

搜索帮助