加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
codingyjq 提交于 2022-01-11 13:54 . vue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
</head>
<style>
.active{
width: 200px;
}
</style>
<body>
<div id="app">
<p>{{message}}</p>
<!-- <div v-if="isLogin">heelo:tom</div>
<div v-else="isLogin">please login</div> -->
<div v-show="isLogin">hello:tom</div>
<hr>
<ul>
<li v-for="item in items">{{item}}</li>
</ul>
<hr>
<p>
<span v-text="span1"></span>
<span>{{span1}}</span>
<span v-html='span2'></span>
</p>
<hr>
scores:<span>{{count}}</span>
<button v-on:click='add'>+</button>
<button @click='reduce'>-</button>
<hr>
<input type="text" placeholder="please enter" v-model="inputVal" v-on:keyup.enter="enter">
<p>input.value:{{inputVal}}</p>
<hr>
<img :src="imgUrl" alt="error" :class="{'active':isOk}">
</div>
<script>
var app = new Vue({
el:'#app',
data: {
message: 'hello Vue',
isLogin:false,
items:[10,11,12,13,14,15],
span1:'hello',
span2:'<h2>hello</h2>',
count:0,
inputVal:'',
imgUrl:"https://img0.baidu.com/it/u=1967997459,1022958762&fm=26&fmt=auto",
isOk:true,
},
methods:{
add() {
this.count++
},
reduce() {
this.count--
},
enter(e) {
console.log(e);
}
}
});
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化