under-over-text.vue 430 B

12345678910111213141516171819202122
  1. <template>
  2. <div v-if="value!=0" style="display: inline">,{{ text }}<span :class="classes"> {{ Math.abs(value) }}</span></div>
  3. </template>
  4. <script>
  5. export default {
  6. name: 'under-over-text',
  7. props: ['value'],
  8. computed: {
  9. text() {
  10. return this.value > 0 ? '超' : '缺'
  11. },
  12. classes() {
  13. return this.value > 0 ? ['f-red', 'bold'] : ['f-warning', 'bold']
  14. }
  15. }
  16. }
  17. </script>
  18. <style scoped>
  19. </style>