karol-f / vue-custom-element

Vue Custom Element - Web Components' Custom Elements for Vue.js
https://karol-f.github.io/vue-custom-element/
MIT License
1.97k stars 187 forks source link

Typed props can't be watched #204

Closed henriquecustodia closed 4 years ago

henriquecustodia commented 4 years ago

Hey there!

I'm trying to watch a boolean prop but when I've change the value, the watch not works

For example:

props: {
   show: {
      type: Boolean,
      default: false
    },
},
 watch: {
    show: {
      handler(val) {
          // called only on mounted lifecycle
      },
      immediate: true
    }

When I change the show prop to:

props: {
    show: Boolean
},
 watch: {
    show: {
      handler(val) {
          // called after every change
      },
      immediate: true
    }

It works...

"vue": "2.6.10" "vue-custom-element": "3.2.5" Browser: Chrome

Thanks!

karol-f commented 4 years ago

Hi, it seems to work fine - https://codesandbox.io/s/vue-template-88l5p?file=/src/main.js