-
-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Labels
Description
How will you show the image after it was taken? I'm using ### nativescript-vue with 'nativescript-vue-template' as the template and this is the code I'm using. Thanks!
const Vue = require('nativescript-vue');
const camera = require('nativescript-camera');
const imageModule = require('tns-core-modules/ui/image');
new Vue({
data() {
return{
image: ""
};
},
methods: {
openCamera()
{
var options = { cameraFacing: 'front'};
camera.requestPermissions();
if(camera.isAvailable())
{
camera.takePicture(options)
.then(function(imageAsset) {
console.log("src: " + imageAsset.android);
var image = new imageModule.Image();
image.src = imageAsset.android;
})
.catch(function (err) {
console.log("Error -> " + err.message);
});
}
}
},
template:
'
<page>
<action-bar title="Test App"></action-bar>
<stack-layout>
<Button @tap="openCamera()" text="Open Camera"></button>
<Image :src="image" />
</stack-layout>
</page>
'
}).$start();