How do you decouple Web Components?

前端 未结 2 1987
野趣味
野趣味 2021-01-20 00:13

I\'m trying to work frameworkless, with pure javascript Web Components. I want my Web Components to be able to work stand-alone and be used on different sites, and yet I als

2条回答
  •  孤街浪徒
    2021-01-20 00:29

    With Web Components you can pass objects through attributes as you said, but you can also pass an object with a method, or throug a property (which is actually a setter method).

    
    ...
    var myObject = { y:1, y:2 }
    comp1.value = myObject     //via property
    comp1.setValue( myObject ) //via method
    

提交回复
热议问题