演示
代码
<template>
<div class="main">
<span class="arrUp" @click="clickUp" :style="{ 'border-bottom-color': color1 }"></span>
<span class="arrDown" @click="clickDown" :style="{ 'border-top-color': color2 }"></span>
</div>
</template>
<script>
export default {
name: "SmallTriangle",
data() {
return {
color1: "#0099ff",
color2: "#ffffff",
isPositiveSequence: true
}
},
methods: {
clickUp() {
if (this.isPositiveSequence) {
return
}
this.isPositiveSequence = true
this.temp()
this.$emit('clickTriangle', true);
console.log("SmallTriangle---------clickUp");
},
clickDown() {
if (!this.isPositiveSequence) {
return
}
this.isPositiveSequence = false
this.temp()
this.$emit('clickTriangle', false);
console.log("SmallTriangle---------clickDown");
},
temp() {
let temp = this.color1;
this.color1 = this.color2;
this.color2 = temp;
}
}
}
</script>
<style scoped>
.main {
display: flex;
flex-direction: column;
}
.arrUp {
width: 0;
height: 0;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
border-bottom: 5px solid gray;
cursor: pointer;
}
.arrDown {
width: 0;
height: 0;
margin-top: 2px;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
border-top: 5px solid gray;
cursor: pointer;
}
</style>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73