Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

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

Open
nanami-yu opened this issue Apr 27, 2021 · 4 comments
Labels
Bug Something isn't working

Comments

@nanami-yu
Copy link

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
Copy link

3rdlab commented Aug 25, 2021

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
Copy link
Contributor

@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
Copy link

3rdlab commented Sep 26, 2021

@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 adhrinae added the Bug Something isn't working label Sep 28, 2021
@adhrinae
Copy link
Contributor

adhrinae commented Sep 28, 2021

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants