1
的X標籤規格有純JS以下簽名 -你如何定義打字稿接口簽名的X標籤組件
xtag.register('x-accordion', {
// extend existing elements
extends: 'div',
mixins: ['superdefaults', 'otherdefaults'],
lifecycle:{
created: function(){
// fired once at the time a component
// is initially created or parsed
},
inserted: function(){
// fired each time a component
// is inserted into the DOM
},
removed: function(){
// fired each time an element
// is removed from DOM
},
attributeChanged: function(){
// fired when attributes are set
}
},
events: {
'click:delegate(x-toggler)': function(){
// activate a clicked toggler
}
},
accessors: {
'togglers': {
get: function(){
// return all toggler children
},
set: function(value){
// set the toggler children
}
}
},
methods: {
nextToggler: function(){
// activate the next toggler
},
previousToggler: function(){
// activate the previous toggler
}
}
});
其中明顯的方法,訪問者和事件可以有多個條目。
我想定義傳遞給寄存器函數的對象字面量的Typescript等價物。任何人有任何想法如何實現這一目標?
你可以添加你已經嘗試過嗎?你需要哪方面的幫助? – WiredPrairie