# SelectorQuery NodesRef.context(function callback)
Start from base library version 2.4.2. Please remaining backward compatible.
with Promise style call: Not supported
Mini Program plugin: Support
Add node Context Object query request. Current support VideoContext、CanvasContext、LivePlayerContext、EditorContextand MapContext The acquisition of.
# parameter
# function callback
Callback function, before executing SelectorQuery.exec
Method, returns node information.
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
context | Object | Node corresponding Context object |
# Return value
# SelectorQuery
# sample code
Page({
getContext () {
wx.createSelectorQuery().select('.the-video-class').context(function(res){
console.log(res.context) // Node corresponding Context Object. For example: the selected node is <video> Component, this is where we return VideoContext object
}).exec()
}
})