perf.vue 1018 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div class="container" v-if="dt && dt.rows.length>0">
  3. <div>
  4. <el-button type="text" icon="el-icon-warning"> {{dt.title}}</el-button>
  5. </div>
  6. <template v-for="(chart,index) in dt.rows">
  7. <lineChart :model="chart" :key="index" v-if="chart.show"></lineChart>
  8. </template>
  9. </div>
  10. </template>
  11. <script>
  12. import lineChart from './lineChart.vue';
  13. import _forEach from 'lodash/forEach';
  14. import _filter from 'lodash/filter';
  15. export default{
  16. props:{
  17. dt:Object
  18. },
  19. components:{
  20. lineChart
  21. },
  22. watch:{
  23. 'dt.rows':{
  24. handler(val){
  25. if(val.length === _filter(val,{show:false}).length ){
  26. this.dt.show = false;
  27. }
  28. },
  29. deep:true
  30. }
  31. }
  32. }
  33. </script>
  34. <style scoped>
  35. .container{
  36. padding: 20px;
  37. background: #f2f2f2;
  38. }
  39. .chart-container{
  40. padding: 20px;
  41. background: #ffffff;
  42. }
  43. </style>