Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get element in nativescript using vue?

I want to get Image element with id='item' on created.

I can't seem to find anything on google. Most of the tutorial on the internet is using Typescript and always start with page=args.object

export function pageLoaded(args) {
    page = args.object;
    item = page.getViewById("item");
}
like image 918
GTHell Avatar asked Aug 25 '18 10:08

GTHell


1 Answers

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;
}
like image 102
Mennolp Avatar answered Oct 13 '22 02:10

Mennolp