Skip to content
This repository was archived by the owner on Mar 1, 2020. It is now read-only.

Commit 6edeeee

Browse files
committed
Clean up template to showcase usage of components
1 parent 97076e8 commit 6edeeee

File tree

13 files changed

+83
-276
lines changed

13 files changed

+83
-276
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ This repo serves as the starting point for NativeScript + Vue.js projects, using
44

55
## Usage
66

7-
1. Install NativeScript tools (see http://docs.nativescript.org/start/quick-setup)
7+
1. Install NativeScript tools (see http://docs.nativescript.org/start/quick-setup)
8+
9+
2. Create app from this template
810

9-
2. Create app from this template
1011
```bash
1112
tns create hello-ns-vue --template nativescript-vue-template
1213

@@ -16,7 +17,8 @@ cd hello-ns-vue
1617
> While the `nativescript-vue` project is not up-to-date on npm, you may have to run
1718
> `npm link nativescript-vue` in the project folder (like [described here](https://github.com/rigor789/nativescript-vue/blob/master/CONTRIBUTING.md)).
1819
19-
3. Run in Android or iOS
20+
3. Run in Android or iOS
21+
2022
```bash
2123
tns run android
2224
tns run ios

app-with-list-view.js

Lines changed: 0 additions & 101 deletions
This file was deleted.

app-with-router.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

app-with-tab-view.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

app-with-vmodel.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

app.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
11
@import 'nativescript-theme-core/css/core.light.css';
2-
3-
/* Your CSS goes here */
4-
5-
.even {
6-
color: red;
7-
}
8-
9-
.odd {
10-
color: blue;
11-
}

app.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

components/App.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const Counter = require('./Counter');
2+
3+
module.exports = {
4+
data() {
5+
return {
6+
surprise: false,
7+
};
8+
},
9+
template: `
10+
<Page class="page">
11+
<ActionBar class="action-bar" title="NativeScript-Vue"/>
12+
13+
<StackLayout>
14+
<Counter />
15+
16+
<Label class="p-20" textWrap=true text="This is a hello world application, tap the button if you dare"/>
17+
18+
<Button class="btn btn-primary" @tap="surprise = !surprise" text="Tap me!"/>
19+
<Image v-if="surprise" class="m-20" src="~/images/NativeScript-Vue.png"/>
20+
</StackLayout>
21+
</Page>
22+
`,
23+
components: {
24+
Counter,
25+
},
26+
};

components/Counter.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
data() {
3+
return {
4+
count: 42,
5+
};
6+
},
7+
computed: {
8+
message() {
9+
return this.count > 0
10+
? `Tap tap tap! Only ${this.count} left!`
11+
: `Whoa! Slow down, we have hit the limit...`;
12+
},
13+
},
14+
template: `
15+
<StackLayout>
16+
<FlexboxLayout flexDirection="row" justifyContent="center">
17+
<Button @tap="decrement" text="-" class="btn btn-outline"/>
18+
<Label :text="count" alignSelf="baseline" class="h2"/>
19+
<Button @tap="increment" text="+" class="btn btn-outline"/>
20+
</FlexboxLayout>
21+
22+
<Label class="p-20" :text="message"/>
23+
</StackLayout>
24+
`,
25+
methods: {
26+
increment() {
27+
this.count += 1;
28+
},
29+
decrement() {
30+
this.count -= 1;
31+
},
32+
},
33+
};

images/apple.jpg

-270 KB
Binary file not shown.

0 commit comments

Comments
 (0)