nhn / toast-ui.vue-calendar

Toast UI Calendar for Vue
MIT License
195 stars 54 forks source link

make it for a component,but when two page use it,some value was be covered #56

Open nanami-yu opened 3 years ago

nanami-yu commented 3 years ago

Version

toast-ui/vue-calendar: 1.1.1

Test Environment

Chrome,Window10, vue-element-admin

Current Behavior

// Write example code
// i use props[isExamine] check how to show the button
        popupDelete: function() {
          if (that.isExamine) {
            return '退回'
          } else {
            return '删除'
          }
        }
// when two page use this component 
// open one and  open two , now two page is right
// but when open one again(use vue keepalive) isExamine is another page value
// now i delete keepalive,two page work right,but i want to use keepalive

Expected Behavior

show right value

3rdlab commented 3 years ago

Same problems here.

template properties are not properly coming back when it changed with keep-alive.

@nanami-yu Try to set options when the component is activated. It will fix the problem temporary

 activated() {
    this.$refs.calendar.invoke('setOptions', { template: this.templates })
   ...
  },
adhrinae commented 3 years ago

@3rdlab It seems the right behavior for components wrapped in the keep-alive component. Could you post any sandboxes reproducing the problem made with something like codesandbox, glitch?

3rdlab commented 3 years ago

@adhrinae

Could you check this code?

https://codesandbox.io/s/objective-fast-6y9po

I fetched data on activated event because of keep-alive set up.

I think refetching data on activated event might cause the problem

adhrinae commented 3 years ago

@3rdlab I'm sorry but I'm not sure the root cause of the problem. Removing the keep-alive component from the calendar or your workaround might be helpful. I'll look into it deeper later.