Webcomponent must use immutable value to set property? #13638
              
                Unanswered
              
          
                  
                    
                      CrabSAMA
                    
                  
                
                  asked this question in
                Help/Questions
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
when i try to use web component in Vue, such as this example: https://play.vuejs.org/#eNqNVF1P2zAU/SuWX5JKnStg06QSqn0hbRMMNHjDCIX0tgQc2/JHR1Xlv+9eh3Ypq7q9tMn9OPec4+us+EdrxSICH/PCV662gXkI0U6krhtrXGAr5mDGWjZzpmEZlmabVCZGAXzIjqWWujLaB6Zq/Dmhlvzm4HYgdTHqYBEQXwI0VpUB8I2xwk5Wq66jbYsRzcTgfQzBaPahUnX1dCJ5PmAnE2RBdcJG/5AfDlgr+STaKSJ1/dEDo1wx6tr/DYUkb4QQ9Dhkh7c7EeumiaG8V7AN2yzfVAYd0KADG6vSzQHBqUtyNp7CrNZwthWdFKN+E8IU6NzGCj7kwaN/s3ouHr3ReBgrmiQ5tdQK3IUNNfor+ZilDOVKpcyv7ykWXIThOl49QPW0I/7onykm+aUDD24Bkm9ygegiUUqfXv2AZ3zeJBszjQqr9yR/gjcqEseu7FPUU6Tdq0tsv6W9qfX82p8+B9B+LYqIUmWb6iXHNfu8R/ofukfibeqTuiUXcRvRQfSvUqX37HxJKN1BIW3QU8++Xp+fnSpoKJYA79IJfilDiTuxQiQM9Q5xK4F3g6XyfFGqCIM1JVp+o0AoM8+zKwiksStkuFLlOBuyrgGvCtWHh9qLrcEpnbI4iP5Q4MuozRSHN9Pp183rptR3cf8IVRAd/0tnLLiwzHs+COtMMGFpYciynkxkmKagwjGbRV2R6+x/ZPZA9on929Ke5HTsqLg/erfsVzAb8TQMP0LRB9O8HK9/sSHP+pcP2fXsGBzj2twtwNEq4t4ciXfi4D1vfwNWjLl7
i console log in two way:
if the property of web component changed, it will log in console
Then if i use
Array.pushto set value, it will do nothing, if i use imutable value to set value, it will trigger console log in web component.I probably know why, in JavaScript complex variable is reference passing, use
pushdid not change the reference, so it will not trigger console. Vue do some thing with Proxy to hack some action just likepush, so that Vue can know the value has changed.Now i has two question:
el[prop] = newVal) to a component when it changes for web components?Beta Was this translation helpful? Give feedback.
All reactions