| | |
| | | <template> |
| | | <div class="thermometer" :class="{ active: state}"> |
| | | <div class="line"></div> |
| | | <div class="arc"></div> |
| | | </div> |
| | | <div class="thermometer" :class="{ active: state}"> |
| | | <div class="line"></div> |
| | | <div class="arc"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | export default { |
| | | props: ['switch'], |
| | | data() { |
| | | return { |
| | | state: false |
| | | } |
| | | return { |
| | | state: false |
| | | } |
| | | }, |
| | | watch: { |
| | | 'switch': { |
| | | handler(val) { |
| | | this.state = val |
| | | 'switch': { |
| | | handler(val) { |
| | | this.state = val |
| | | }, |
| | | deep: true |
| | | }, |
| | | deep: true |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.state = this.switch |
| | | this.state = this.switch |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .thermometer { |
| | | .thermometer { |
| | | width: 16px; |
| | | height: 72px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | flex-direction: column; |
| | | } |
| | | } |
| | | |
| | | .line { |
| | | .line { |
| | | width: 8px; |
| | | height: 54px; |
| | | background-color: #ffffff; |
| | | border-radius: 4px 4px 0 0; |
| | | overflow: hidden; |
| | | position: relative; |
| | | } |
| | | } |
| | | |
| | | .thermometer.active .line::before { |
| | | .thermometer.active .line::before { |
| | | content: ""; |
| | | display: block; |
| | | width: 6px; |
| | |
| | | bottom: 0; |
| | | left: 1px; |
| | | background: -webkit-linear-gradient(top, #ffffff, #318bf1); |
| | | } |
| | | } |
| | | |
| | | .arc { |
| | | .arc { |
| | | width: 18px; |
| | | height: 18px; |
| | | border-radius: 50%; |
| | |
| | | margin-top: -1px; |
| | | overflow: hidden; |
| | | position: relative; |
| | | } |
| | | } |
| | | |
| | | .thermometer.active .arc::before { |
| | | .thermometer.active .arc::before { |
| | | content: ""; |
| | | display: block; |
| | | width: 20px; |
| | |
| | | position: absolute; |
| | | bottom: -1px; |
| | | left: -1px; |
| | | } |
| | | } |
| | | </style> |