Skip to content

Commit 5eee0c4

Browse files
committed
fancyalert
1 parent 43f30c5 commit 5eee0c4

File tree

5 files changed

+101
-23
lines changed

5 files changed

+101
-23
lines changed

app/components/example/Fancyalert.vue

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<Page class="page">
3+
<ActionBar class="action-bar" title="Fancyalert">
4+
<NavigationButton text="Go Back" android.systemIcon="ic_menu_back" @tap="$navigateBack" />
5+
</ActionBar>
6+
7+
<StackLayout class="hello-world">
8+
<Button class="btn btn-primary" @tap="btnfancyalert" text="Fancyalert" />
9+
</StackLayout>
10+
</Page>
11+
</template>
12+
13+
<script>
14+
import { TNSFancyAlert, TNSFancyAlertButton } from 'nativescript-fancyalert';
15+
export default {
16+
data() {
17+
return {
18+
title: ''
19+
};
20+
},
21+
mounted() {},
22+
methods: {
23+
btnfancyalert: function() {
24+
console.log('xxx');
25+
TNSFancyAlert.showSuccess('Success!', 'Fancy alerts are nice.', 'Yes they are!');
26+
}
27+
}
28+
};
29+
</script>
30+
31+
<style scoped>
32+
.hello-world {
33+
margin: 20;
34+
}
35+
36+
label {
37+
color: red;
38+
}
39+
</style>

app/components/example/Main.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,17 @@
2828
<Button class="btn btn-primary" @tap="counter">计数器【Counter】</Button>
2929
<Button class="btn btn-primary" @tap="hello">Vuex及相机</Button>
3030
<Button class="btn btn-primary" @tap="login">模拟登录【login】</Button>
31-
3231
<Button class="btn btn-primary" @tap="btnToast">提示【Toast】</Button>
3332
<Button class="btn btn-primary" @tap="btnAlert">精美提示框【Alert】</Button>
3433
<Button class="btn btn-primary" @tap="info">消息通知【Info】</Button>
35-
3634
<Button class="btn btn-primary" @tap="btnDialog">对话框【Dialog】</Button>
37-
3835
<Button class="btn btn-primary" @tap="btnPlatformModule">平台型号【PlatformModule】</Button>
39-
4036
<Button class="btn btn-primary" @tap="btnPhone">电话【Phone】</Button>
4137
<Button class="btn btn-primary" @tap="btnSms">短信【Sms】</Button>
42-
4338
<Button class="btn btn-primary" @tap="btnGeolocation">定位</Button>
4439
<Button class="btn btn-primary" @tap="btnPermissions">获取权限1</Button>
45-
4640
<Button class="btn btn-primary" @tap="btnPlatformModule">获取设备信息</Button>
4741
<Button class="btn btn-primary btn-green" @tap="btnChange" ref="btn">改变按钮【Change Btn】</Button>
48-
4942
<Label class="message" :text="msg" col="0" row="0" />
5043
<Button class="btn btn-primary" text="路由跳转" @tap="onButtonTap" />
5144
<Button class="btn btn-primary" text="本地存储示例" @tap="onInput" />
@@ -78,9 +71,8 @@
7871
import Counter from './Counter';
7972
import HelloWorlds from './HelloWorld';
8073
import Login from './Login';
81-
82-
import * as Toast from 'nativescript-toast';
83-
import { TNSFancyAlert, TNSFancyAlertButton } from 'nativescript-fancyalert';
74+
import Toast from './toast';
75+
import fancyalert from './Fancyalert';
8476
//import * as LocalNotifications from "nativescript-local-notifications";
8577
import { LocalNotifications } from 'nativescript-local-notifications';
8678
//var LocalNotifications = require("nativescript-local-notifications");
@@ -155,15 +147,23 @@ export default {
155147
});
156148
},
157149
btnToast: function() {
158-
console.log('111');
159-
let toast = Toast.makeText('你好世界【Hello World】', 'long');
160-
toast.show();
150+
this.$navigateTo(Toast, {
151+
animated: true,
152+
transition: {
153+
name: 'slide',
154+
duration: 380,
155+
curve: 'easeIn'
156+
}
157+
});
161158
},
162159
btnAlert: function() {
163-
console.log('xxx');
164-
//TNSFancyAlert.showSuccess('Success!', 'Fancy alerts are nice.', 'Yes they are!');
165-
TNSFancyAlert.showSuccess('成功!Success!', '花哨的提醒很不错。【Fancy alerts are nice.】', '是的【Yes they are!】').then(() => {
166-
/* user pressed the button */
160+
this.$navigateTo(fancyalert, {
161+
animated: true,
162+
transition: {
163+
name: 'slide',
164+
duration: 380,
165+
curve: 'easeIn'
166+
}
167167
});
168168
},
169169
info: function() {

app/components/example/toast.vue

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<Page class="page">
3+
<ActionBar class="action-bar" title="提示">
4+
<NavigationButton text="Go Back" android.systemIcon="ic_menu_back" @tap="$navigateBack" />
5+
</ActionBar>
6+
7+
<StackLayout class="hello-world">
8+
<Button class="btn btn-primary" @tap="btnToast" text="提示" />
9+
</StackLayout>
10+
</Page>
11+
</template>
12+
13+
<script>
14+
import * as Toast from 'nativescript-toast';
15+
export default {
16+
data() {
17+
return {
18+
title: ''
19+
};
20+
},
21+
mounted() {},
22+
methods: {
23+
btnToast: function() {
24+
let toast = Toast.makeText('你好世界【Hello World】', 'long');
25+
toast.show();
26+
}
27+
}
28+
};
29+
</script>
30+
31+
<style scoped>
32+
.hello-world {
33+
margin: 20;
34+
}
35+
36+
label {
37+
color: red;
38+
}
39+
</style>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@vue/devtools": "^5.1.1",
1818
"nativescript-app-shortcuts": "^2.1.0",
1919
"nativescript-camera": "^4.5.0",
20-
"nativescript-fancyalert": "^2.0.0",
20+
"nativescript-fancyalert": "^3.0.9",
2121
"nativescript-geolocation": "5.1.0",
2222
"nativescript-local-notifications": "^3.1.0",
2323
"nativescript-permissions": "^1.2.3",
@@ -59,4 +59,4 @@
5959
"webpack-bundle-analyzer": "~2.13.1",
6060
"webpack-cli": "^3.1.0"
6161
}
62-
}
62+
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,10 +4273,10 @@ nativescript-dev-webpack@next:
42734273
webpack-cli "~3.1.1"
42744274
webpack-sources "~1.3.0"
42754275

4276-
nativescript-fancyalert@^2.0.0:
4277-
version "2.0.1"
4278-
resolved "https://registry.yarnpkg.com/nativescript-fancyalert/-/nativescript-fancyalert-2.0.1.tgz#36f8effb7e9ae36891a754a98791547b14199336"
4279-
integrity sha512-wxAhqLOdfX7a9gpz5Ze+wZ6DAKlw1WrImeG426vEiUal/JfTCuGUBCv2Z47r9nxRWhMNpSGItQYFgHDg2u+UmA==
4276+
nativescript-fancyalert@^3.0.9:
4277+
version "3.0.9"
4278+
resolved "https://registry.yarnpkg.com/nativescript-fancyalert/-/nativescript-fancyalert-3.0.9.tgz#a841b3a6e2bb5f0f495f90037da1390a8fff17d1"
4279+
integrity sha512-pXWXko+vXv9dQi/A2Vyme7rbb6H2m7LSipRVIyY7bksTg+YmL5Ud2zb0m0Tlhq1N4cZEhNPYBRXtLCAwSY2wmQ==
42804280

42814281
nativescript-geolocation@5.1.0:
42824282
version "5.1.0"

0 commit comments

Comments
 (0)