index.vue 917 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <div class="switch">
  3. <i class="el-icon-search"><span>仅查询本级</span></i>
  4. <el-switch v-model="isThisLevel" :active-value="activeValue" :inactive-value="inactiveValue" active-color="#13ce66"
  5. inactive-color="#ff4949" @change="changeLevel">
  6. </el-switch>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. name: "QueryThisLevel",
  12. props: {
  13. initLevel: {
  14. require: true,
  15. },
  16. active: {
  17. default: true,
  18. },
  19. inactive: {
  20. default: false,
  21. },
  22. },
  23. data() {
  24. return {
  25. isThisLevel: parseInt(this.initLevel),
  26. activeValue: this.active,
  27. inactiveValue: this.inactive,
  28. }
  29. },
  30. methods: {
  31. changeLevel(value) {
  32. this.$emit('changeLevel', value);
  33. }
  34. },
  35. }
  36. </script>
  37. <style ref="stylesheet/scss" lang="scss" scoped>
  38. .switch {
  39. display: flex;
  40. align-items: center;
  41. margin: 10px;
  42. justify-content: space-between;
  43. }
  44. </style>