index.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div>
  3. <el-card class="box-card" style="margin:10px" v-for="(item,key) in dataLists" :key="key">
  4. <template #header>
  5. <div class="card-header">
  6. <span>{{item.title}}</span>
  7. </div>
  8. </template>
  9. <Selector
  10. :HsKey="key"
  11. :echo="item.echo"
  12. @selectedVal="selectedVal"
  13. :disabled="item.disabled"
  14. />
  15. <h4 v-if="!item.disabled">选中范围:{{ selectRange }}</h4>
  16. </el-card>
  17. </div>
  18. </template>
  19. <script lang='ts'>
  20. import { ref } from "vue";
  21. import Selector from "/@/components/ReSelector";
  22. export default {
  23. components: { Selector },
  24. setup() {
  25. let selectRange = ref(null);
  26. let dataLists = ref([
  27. {
  28. title: "基本使用",
  29. echo: [],
  30. disabled: false
  31. },
  32. {
  33. title: "回显模式",
  34. echo: [2, 7],
  35. disabled: true
  36. }
  37. ]);
  38. const selectedVal = ({ left, right, whole }) => {
  39. selectRange.value = `${left}-${right}`;
  40. };
  41. return {
  42. selectedVal,
  43. selectRange,
  44. dataLists
  45. };
  46. }
  47. };
  48. </script>