Spaces:
Running
Running
import Alpine from "alpinejs"; | |
Alpine.start(); | |
const app = new Vue({ | |
el: "#app", | |
data: { | |
amount: null, | |
from: null, | |
to: null, | |
}, | |
methods: { | |
submit() { | |
const fromCurrency = this.from; | |
const toCurrency = this.to; | |
if(fromCurrency && toCurrency){ | |
return(html`<h1>The amount of ${amount} in ${fromCurrency} is ${conversion(amount, fromCurrency, toCurrency)} in ${toCurrency}!</h1>`); | |
} else { | |
return(html`<h1>Please select a currency!</h1>`); | |
} | |
}, | |
conversion(amount, fromCurrency, toCurrency){ | |
// Conversion logic | |
} | |
}, | |
}); |