function doGet()
{
return HtmlService.createTemplateFromFile('Index')
.evaluate()
.setTitle('ELE557(Test1)')
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
Code.gs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vue 3</title>
<script src="https://unpkg.com/vue@3"></script>
</head>
<body>
<div id="app">
<input type="text" v-model="greeting">
<p>
{{ greeting }} ({{ greeting.length }})
</p>
</div>
<script>
Vue.createApp({
data() {
return {
greeting: 'Hello world !'
};
},
mounted(){
setTimeout(()=>{
this.greeting = 'changed !';
}, 3000);
}
}).mount('#app');
</script>
</body>
</html>
Index.html
<?!= HtmlService.createHtmlOutputFromFile('Vue3').getContent() ?>
Index.html
<script>
function myObj(){
return {
greeting: 'Hello world !'
}
}
const app = Vue.createApp({
data : myObj,
mounted() {
setTimeout(()=>{
this.greeting = 'changed !';
}, 3000);
},
methods:{
myFunction: function(data){
// CODE HERE //
},
},
})
app.mount('#app');
</script>
Vue3.html
Vuejs cheatsheet
Useful Example
"Set" get unique in JavaScript