I'm trying to update a data variable using Vue 2.x with the contents of an event emitter? (not sure if that's the correct term).
Example:
<script>
var exec = require('child_process').exec;
export default {
data () {
return {
output: ''
}
},
methods: {
test () {
this.output = '';
var myProcess = exec('"./jre/bin/java.exe" -jar -Xmx1024m -Xms256m -Dfile.encoding=UTF8 "./eu_datamatcher.jar" "./runtime.properties"', { cwd: './datamatcher/' });
myProcess.stdout.on('data', function(data) {
// This line isn't correct since this.output is not assigned
this.output += data.toString();
});
}
}
}
</script>
How would I get the data variable to update inside that .on
event?
Thanks!