1. I would like to ask how to write avalon.scan, can you scan only one node instead of the whole document?? In practical applications, there are some html fragments that are temporarily obtained through pjax and only want to scan this part of the node rather than the whole body.
2. In the example on the official website, it says:
avalon.ready(function(){
avalon.define({
$id: "test",
aaa: 111
})
vm.$watch("onReady", function(){
//ms-controller, ms-important
//ms-*
})
//2.1.15
vm.$watch("onDispose", function(){
delete avalon.vmodels[vm.$id]
if(avalon.scopes){
delete avalon.scopes[vm.$id]
}
})
avalon.scan(document.body)
})
3, according to the code, after many tests, this writing seems to be effective, and the writing methods in the examples do not seem to work:
// :
avalon.scan(document.body, model, avalon.noop());
// model
var model = avalon.define({
$id: "vm",
data: {},
...
});
4. Scan for the whole body is very resource-consuming, and it will also affect the style of other tab pages. Solve.