topN.vue 782 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <a-select :value="selected" :dropdownMatchSelectWidth="false" @change="handleChange">
  3. <a-select-option v-for="m of options" :key="m.label" :value="m.value">
  4. {{ m.label }}
  5. </a-select-option>
  6. </a-select>
  7. </template>
  8. <script>
  9. import i18n from '@/locales'
  10. export default {
  11. name: 'TopNSelect',
  12. props: {
  13. value: {
  14. type: Number,
  15. },
  16. },
  17. data () {
  18. const options = [
  19. { label: 'Top 5', value: 5 },
  20. { label: 'Top 10', value: 10 },
  21. { label: 'Top 20', value: 20 },
  22. { label: i18n.t('monitor.text_3'), value: null },
  23. ]
  24. return {
  25. selected: this.value || 10,
  26. options: options,
  27. }
  28. },
  29. methods: {
  30. handleChange (v) {
  31. this.selected = v
  32. this.$emit('change', v)
  33. },
  34. },
  35. }
  36. </script>