Hello everyone! I am revisiting a project that I haven't worked on in a while.
I tried using Vue.js for the first time to create an archery calculator for kinetic energy, velocity, and more. Instead of setting up a full Vue app, I simply used a CDN link. Initially, everything was working perfectly fine. However, upon checking it again, I noticed that the results are no longer updating when numbers are inputted. You can view the codepen here -> https://codepen.io/gchis66/pen/ZERKBwd
new Vue({
el: "#archery-calculator",
data() {
return {
IBO:'',
drawLength:'',
drawWeight:'',
arrowWeight:'',
additionalWeight:'',
arrowLength:'',
distanceFromNock:''
}
},
computed: {
calcVelocity: function(e){
let ibo = this.IBO;
let dL = this.drawLength;
let dW = this.drawWeight;
let aW = this.arrowWeight;
let adW = this.additionalWeight;
let result = ibo + (dL - 30) * 10 - adW / 3 + Math.min(0,-(aW - (5*dW))/ 3);
let truncated = Math.round(result);
if (truncated > 0){
return truncated;
}else{
return 0;
}
},
calcKineticEnergy: function(){
let ibo = this.IBO;
let dL = this.drawLength;
let dW = this.drawWeight;
let aW = this.arrowWeight;
let adW = this.additionalWeight;
let s = ibo + (dL - 30) * 10 - adW / 3 + Math.min(0,-(aW - (5*dW))/ 3);
let result = (aW*(s**2))/450800;
let truncated = Math.round(result);
return truncated;
},
calcMomentum: function(){
let ibo = this.IBO;
let dL = this.drawLength;
let dW = this.drawWeight;
let aW = this.arrowWeight;
let adW = this.additionalWeight;
let velocity = ibo + (dL - 30) * 10 - adW / 3 + Math.min(0,-(aW - (5*dW))/ 3);
let momentum = (aW * velocity)/225400;
let truncated = momentum.toFixed(2);
return truncated;
},
calcFoc: function(){
let aL = this.arrowLength;
let dN = this.distanceFromNock;
let result = ((100 * (dN-(aL/2)))/aL);
if (result > 0) {
return result.toFixed(1);
}
else{
return 0;
}
}
}
});
I encountered the error message "Vue is not a constructor". There's most likely a simple issue causing this problem, but I'm running short on time and thought I'd ask for help here since this calculator is live on a website.
Any assistance would be greatly appreciated!