0

I would like to know how I can get the length of my array in Native script /vue JS?

My code :

export default {
    data: () => {
        return {
            i: 0,
            log: [],
            img:[
                "~/Pictures/home.png",
                "~/Pictures/test.png"
                ],
        };
    },

Do you have an idea?

Chalist
  • 3,160
  • 5
  • 39
  • 68

1 Answers1

1

You could use a computed property for this.

Assuming you want the length of the img array:

export default {
  data() {
    return {
      img: ["~/Pictures/home.png", "~/Pictures/test.png"]
    };
  },
  computed: {
    imgArrayLength() {
      return this.img.length;
    }
  }
};
</script>
tony19
  • 125,647
  • 18
  • 229
  • 307
dummker
  • 315
  • 1
  • 13