text2code / script.js
hamzaou's picture
Upload 5 files
551be09
function app() {
return {
open: false,
loading: false,
selectedPrompt: null,
init() {
},
async generateCode() {
this.open = !this.open;
this.loading = !this.loading;
const prompt = document.getElementById('prompt-input').value;
console.log('Prompt:', prompt);
// try {
// const prompt = document.getElementById('prompt-input').value;
// } catch (error) {
// console.error('Error generating code:', error);
// } finally {
// // Update the loading state
// this.loading = !this.loading;
// }
},
updateContent(prompt) {
document.getElementById('prompt-input').value = prompt;
},
copyGeneratedCode() {
const generatedCodeElement = document.getElementById('generated-code');
const codeToCopy = generatedCodeElement.textContent;
},
};
}