How to get element in nativescript using vue?
You can use refrences for this.
Sample xml:
<StackLayout ~body class="body" row="1">
or:
<StackLayout ref="body" class="body" row="1">
Sample code:
mounted() {
let body = this.$refs.body;
}
As mentioned in the comments of the other answers:
<StackLayout ref="body" class="body" row="1">
mounted() {
let body = this.$refs.body;
}
Also you can access the
nativeView
by accessing it's property: letnativeLayout = this.$refs.body.nativeView
;
In NativeScript-Vue the nativeView
of a ViewComponent
is the wrapper element of the actual native platform (iOS/Android) element/view.
For example the nativeView
of the ref="body"
is the StackLayout
of the tns-core-modules and it has a nativeViewProtected
property which is the actual native framework element (on iOS UIView and android.view.View on Android)