Skip to content

Commit 360688f

Browse files
Add Vue template
1 parent 0a1ac6a commit 360688f

34 files changed

+988
-1
lines changed

templates/VueSpa/.deployment

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[config]
2+
SCM_SCRIPT_GENERATOR_ARGS=--aspNetCore project.json
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import './css/site.css';
2+
import Vue from 'vue';
3+
import router from './router';
4+
5+
const App = require('./components/app/app.vue.html');
6+
7+
new Vue({
8+
el: 'app',
9+
render: h => h(App, { props: {} }),
10+
router: router
11+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Vue from 'vue';
2+
import { Component } from 'av-ts';
3+
4+
@Component({
5+
components: {
6+
MenuComponent: require('../navmenu/navmenu.vue.html')
7+
}
8+
})
9+
export default class AppComponent extends Vue {
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div class="container-fluid">
3+
<div class="row">
4+
<div class="col-sm-3">
5+
<menu-component />
6+
</div>
7+
<div class="col-sm-9">
8+
<router-view></router-view>
9+
</div>
10+
</div>
11+
</div>
12+
13+
</template>
14+
15+
<script src="./app.ts"></script>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Vue from 'vue';
2+
import { Component } from 'av-ts';
3+
4+
@Component
5+
export default class CounterComponent extends Vue {
6+
currentcount: number = 0;
7+
8+
incrementCounter() {
9+
this.currentcount++;
10+
}
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<div>
3+
<h1>Counter</h1>
4+
5+
<p>This is a simple example of a Vue.js component.</p>
6+
7+
<p>Current count: <strong>{{ currentcount }}</strong></p>
8+
9+
<button @click="incrementCounter">Increment</button>
10+
</div>
11+
</template>
12+
13+
<script src="./counter.ts"></script>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Vue from 'vue';
2+
import { Component, Lifecycle } from 'av-ts';
3+
4+
interface WeatherForecast {
5+
dateFormatted: string;
6+
temperatureC: number;
7+
temperatureF: number;
8+
summary: string;
9+
}
10+
11+
@Component
12+
export default class FetchDataComponent extends Vue {
13+
forecasts: WeatherForecast[] = [];
14+
15+
@Lifecycle mounted() {
16+
fetch('/api/SampleData/WeatherForecasts')
17+
.then(response => response.json() as Promise<WeatherForecast[]>)
18+
.then(data => {
19+
this.forecasts = data;
20+
});
21+
}
22+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<template>
2+
<div>
3+
<h1>Weather forecast</h1>
4+
5+
<p>This component demonstrates fetching data from the server.</p>
6+
7+
<table v-if="forecasts.length" class="table">
8+
<thead>
9+
<tr>
10+
<th>Date</th>
11+
<th>Temp. (C)</th>
12+
<th>Temp. (F)</th>
13+
<th>Summary</th>
14+
</tr>
15+
</thead>
16+
<tbody>
17+
<tr v-for="item in forecasts">
18+
<td>{{ item.dateFormatted }}</td>
19+
<td>{{ item.temperatureC }}</td>
20+
<td>{{ item.temperatureF }}</td>
21+
<td>{{ item.summary }}</td>
22+
</tr>
23+
</tbody>
24+
</table>
25+
26+
<p v-else><em>Loading...</em></p>
27+
</div>
28+
</template>
29+
30+
<script src="./fetchdata.ts"></script>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<div>
3+
<h1>Hello, world!</h1>
4+
<p>Welcome to your new single-page application, built with:</p>
5+
<ul>
6+
<li><a href="https://get.asp.net/">ASP.NET Core</a> and <a href="https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx">C#</a> for cross-platform server-side code</li>
7+
<li><a href="https://vuejs.org/">Vue.js</a> and <a href="http://www.typescriptlang.org/">TypeScript</a> for client-side code</li>
8+
<li><a href="https://webpack.github.io/">Webpack</a> for building and bundling client-side resources</li>
9+
<li><a href="http://getbootstrap.com/">Bootstrap</a> for layout and styling</li>
10+
</ul>
11+
<p>To help you get started, we"ve also set up:</p>
12+
<ul>
13+
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
14+
<li><strong>Webpack dev middleware</strong>. In development mode, there"s no need to run the <code>webpack</code> build tool. Your client-side resources are dynamically built on demand. Updates are available as soon as you modify any file.</li>
15+
<li><strong>Hot module replacement</strong>. In development mode, you don"t even need to reload the page after making most changes. Within seconds of saving changes to files, your Knockout app will be rebuilt and a new instance injected is into the page.</li>
16+
<li><strong>Code splitting and lazy loading</strong>. KO components may optionally be bundled individually and loaded on demand. For example, the code and template for "Counter" is not loaded until you navigate to it..</li>
17+
<li><strong>Efficient production builds</strong>. In production mode, development-time features are disabled, and the <code>webpack</code> build tool produces minified static CSS and JavaScript files.</li>
18+
</ul>
19+
</div>
20+
</template>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<div class="main-nav">
3+
<div class="navbar navbar-inverse">
4+
<div class="navbar-header">
5+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
6+
<span class="sr-only">Toggle navigation</span>
7+
<span class="icon-bar"></span>
8+
<span class="icon-bar"></span>
9+
<span class="icon-bar"></span>
10+
</button>
11+
<a class="navbar-brand" href="/">WebApplicationBasic</a>
12+
</div>
13+
<div class="clearfix"></div>
14+
<div class="navbar-collapse collapse">
15+
<ul class="nav navbar-nav">
16+
<li>
17+
<router-link to="/" :exact="true">
18+
<span class="glyphicon glyphicon-home"></span> Home
19+
</router-link>
20+
</li>
21+
<li>
22+
<router-link to="/counter">
23+
<span class="glyphicon glyphicon-education"></span> Counter
24+
</router-link>
25+
</li>
26+
<li>
27+
<router-link to="/fetchdata">
28+
<span class="glyphicon glyphicon-th-list"></span> Fetch data
29+
</router-link>
30+
</li>
31+
</ul>
32+
</div>
33+
</div>
34+
</div>
35+
</template>

0 commit comments

Comments
 (0)