Accessing to the device gallery


#1

Hello, I’m new to the Vue Native, I did some search and found nativescript-imagepicker, but could not figure how to use with VueNative.

I registered the module as below but could not find in vue instance. Then I imported in the component but I got error.

Failed to find module nativescript-permissions

Main.js
Vue.registerElement(‘imgPick’, () => require(‘nativescript-imagepicker’).ImagePicker);

Can you help me ?


#2

how about install nativescript-permissions?

npm install nativescript-permissions --save

Also, the registerElement is only for packages that have components. ImagePicker is not a component, i.e., you don’t add it to the template. You just use it in your code to invoke the gallery. See the nativescript-imagepicker docs.

I have an example of using that plugin, but it is probably very outdated… use with caution: https://github.com/tralves/not-hotdog-ns-vue/blob/master/app/MainPage.vue


#3

I found what was causing. I installed the plugins but never run npm run clean. I execute the script then followed your code, worked. Thank you, I was about return Cordova, you saved me :slight_smile: