<html>
<head>
<meta charset="utf-8">
<style>
@import url("//unpkg.com/element-ui@2.15.7/lib/theme-chalk/index.css");
</style>
</head>
<body>
<div id="App">
<div v-for="(item,key) in crop" style="display: inline-block; margin-right: 10px;">
<div :id="key" style="width: 30px;height: 30px;border: 1px solid black;" @mouseover="over(item.id)" @mouseleave="leave(item.id)">
{{item.id}}
</div>
</div>
</div>
<script src="js/vue.min.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
var MyVue1 = new Vue({
el:'#App',
data:{
crop:[{id:1},{id:2},{id:3},{id:4}]
},
methods: {
over(e)
{
document.getElementById(e-1).style.color = "red"
document.getElementById(e-1).style.width = "100px"
document.getElementById(e-1).style.height = "100px"
},
leave(e)
{
document.getElementById(e-1).style.color = "black"
document.getElementById(e-1).style.width = "30px"
document.getElementById(e-1).style.height = "30px"
}
},
})
</script>
</body>
</html>
|