Files
ClassContent/历届学生/陈一航/2020-04-20/class.html
2024-09-27 02:06:13 +08:00

60 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
.red{
color: red;
}
</style>
</head>
<body>
<div class="app">
<div v-html="html"></div>
<a :href="href">{{baidu}}</a>
<ul>
<li v-for="b,index in Newlist"
@click="changgeRed(index)"
:class="index == indexx ? 'red' : '' ">
{{b.title}}:{{index+1}}
</li>
<h2 v-for='b,index in Newlist'>
<div v-if="index == indexx">
{{b.content}}
</div>
</h2>
</ul>
<input v-model="cd" type="text" placeholder="请输入">
{{ cd }}
</div>
</body>
<script>
var app = new Vue({
el: '.app',
data: {
baidu:'百度',
href: 'wwww.baidu.com',
html: '<h2>这是h2</h2>',
indexx: 0,
Newlist:[
{title: 'tabs1',content: '1'},
{title: 'tabs2',content: '2'},
{title: 'tabs3',content: '3'},
{title: 'tabs4',content: '4'}
],
cd: ''
},
methods:{
changgeRed(index){
this.indexx =index
console.log(index);
}
}
})
</script>
</html>