refreshComponent.js 479 B

1234567891011121314151617181920212223242526
  1. const refreshComponentMixin = {
  2. data () {
  3. return {
  4. updateKey: 0
  5. }
  6. },
  7. computed: {
  8. Data () {
  9. return JSON.parse(JSON.stringify(this.config))
  10. }
  11. },
  12. watch: {
  13. Data: {
  14. handler (newVal, oldVal) {
  15. this.$nextTick(() => {
  16. if ((newVal.w !== oldVal.w) || (newVal.h !== oldVal.h)) {
  17. this.updateKey = new Date().getTime()
  18. }
  19. })
  20. },
  21. deep: true
  22. }
  23. }
  24. }
  25. export { refreshComponentMixin }