index.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div class="test">
  3. <Child />
  4. <h1>用户名: {{ customize.username }}</h1>
  5. <br>
  6. <div
  7. v-for="(row, key) in optionData"
  8. :key="key"
  9. class="item"
  10. @click="linkage(row)"
  11. >
  12. <span> {{ row[option.xField] }}</span> -
  13. <span> {{ row[option.yField] }}</span>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import Child from './Child.vue'
  19. export default {
  20. name: 'TestB',
  21. components: {
  22. Child
  23. },
  24. props: {
  25. config: {
  26. type: Object,
  27. default: () => ({})
  28. }
  29. },
  30. data () {
  31. return {
  32. }
  33. },
  34. computed: {
  35. option () {
  36. return this.config.option
  37. },
  38. optionData () {
  39. return this.option.data
  40. },
  41. customize () {
  42. return this.option.customize
  43. }
  44. },
  45. methods: {
  46. linkage (row) {
  47. this.$emit('linkage', row)
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .test {
  54. width: 100%;
  55. height: 100%;
  56. position: absolute;
  57. color: #fff;
  58. font-size: 20px;
  59. background: #ccc;
  60. .item {
  61. width: 100%;
  62. height: 50px;
  63. line-height: 50px;
  64. text-align: center;
  65. }
  66. }
  67. </style>