Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created March 6, 2017 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/bb36d6dc010b57bfd91c34d2cecf3ce7 to your computer and use it in GitHub Desktop.
Save justinyoo/bb36d6dc010b57bfd91c34d2cecf3ce7 to your computer and use it in GitHub Desktop.
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 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