linstener.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // 常规列表混入
  2. export default {
  3. data() {
  4. return {
  5. resizeTime: true,
  6. windowWidth: 0,
  7. isVs3D: false,
  8. distance: 300, // 3D饼图大小配置
  9. isVsTab: false,
  10. leftBtn: true,
  11. rightBtn: true,
  12. }
  13. },
  14. watch: {
  15. '$store.state.typeTime' (val) {
  16. console.log(val)
  17. this.getData && this.getData(val)
  18. },
  19. '$store.state.timeList' (val) {
  20. console.log(val)
  21. this.getData && this.getData(val)
  22. }
  23. },
  24. mounted() {
  25. // window.addEventListener("resize", this.resizeTimeActions);
  26. },
  27. methods: {
  28. resizeTimeActions(list) {
  29. console.log(this.resizeTime)
  30. if (!this.resizeTime) return;
  31. console.log(list)
  32. this.resizeTime = false
  33. setTimeout(() => {
  34. list.forEach(element => {
  35. console.log(element)
  36. element && element.resize()
  37. });
  38. this.resizeTime = true
  39. this.windowWidth = document.documentElement.clientWidth + document.documentElement.clientHeight
  40. }, 0);
  41. },
  42. vsClick(val) {
  43. this[val] = !this[val]
  44. if (val === 'isVs3D') {
  45. if (this.isVs3D) {
  46. this.$nextTick(() => {
  47. // this.distance = 200
  48. this.$refs.pieThreeD1 && this.$refs.pieThreeD1.resize();
  49. this.$refs.pieThreeD2 && this.$refs.pieThreeD2.resize();
  50. })
  51. } else {
  52. this.$nextTick(() => {
  53. // this.distance = 150
  54. this.$refs.pieThreeD1 && this.$refs.pieThreeD1.resize();
  55. this.$refs.pieThreeD2 && this.$refs.pieThreeD2.resize();
  56. })
  57. }
  58. }
  59. },
  60. leftBtnClick() {
  61. this.leftBtn = !this.leftBtn
  62. },
  63. rightBtnClick() {
  64. this.rightBtn = !this.rightBtn
  65. }
  66. },
  67. unmount() {
  68. window.removeEventListener("resize", this.resizeTimeActions, true);
  69. },
  70. };