1 Star 0 Fork 0

leemen / geektime-vue-1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
zeka 提交于 2019-03-22 19:58 . fix
<html>
<head>
<style>
.item {
color: red;
}
</style>
</head>
<body>
<div id="app">
{{msg}}
<div>
<input type="text" v-model="info">
<button @click="handleClick">添加</button>
</div>
<ul>
<todo-item v-for="item in list" :item="item"></todo-item>
</ul>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
<script>
Vue.component('todo-item', {
props: ['item'],
template: '<li class="item">{{item}}</li>'
})
new Vue({
el: '#app',
data() {
return {
msg: 'hello geektime',
info: '',
list: [],
}
},
methods: {
handleClick() {
this.list.push(this.info)
this.info = ''
}
}
})
</script>
</body>
</html>
JavaScript
1
https://gitee.com/leemen/geektime-vue-1.git
git@gitee.com:leemen/geektime-vue-1.git
leemen
geektime-vue-1
geektime-vue-1
master

搜索帮助