Create a gist now

Instantly share code, notes, and snippets.

@justinyoo /Hello.ts Secret
Created Feb 23, 2017

What would you like to do?
Running Vue.js with TypeScript on ASP.NET Core Application
// Hello.vue
import axios from 'axios'
export default {
name: 'hello',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
},
created () {
axios.get('/api/hello')
.then((res) => {
this.msg = res.data.message
})
.catch((ex) => console.log(ex))
}
}
// Hello.ts
import * as Vue from "vue";
import Component from "vue-class-component";
import axios from "axios";
@Component({
name: "Hello",
})
export default class Hello extends Vue {
msg: string = "Welcome to Your Vue.js App";
created (): void {
axios.get("/api/hello")
.then((res) => {
this.msg = res.data.message;
})
.catch((ex) => console.log(ex));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment