Skip to content

Commit 7fab0bb

Browse files
committed
example: add another example using vue Object api
1 parent d433078 commit 7fab0bb

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

examples/index.example2.html

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!-- Paystack example using Vue Object api -->
2+
<html>
3+
4+
<head>
5+
<title>Vue PayStack Example</title>
6+
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
7+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css"
8+
integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
9+
<script src="https://unpkg.com/vue@next"></script>
10+
<script src="../dist/paystack.umd.min.js"></script>
11+
<style>
12+
body {
13+
font-size: 1em;
14+
font-family: 'Tahoma', sans-serif;
15+
}
16+
</style>
17+
</head>
18+
19+
<body>
20+
<div id="app">
21+
<pay-stack :amount="amount" :email="email" :paystackkey="paystackkey" :reference="reference"
22+
:callback="callback" :close="close" :embed="false" />
23+
<i class="fas fa-money-bill-alt"></i>
24+
Make Payment
25+
</pay-stack>
26+
</div>
27+
28+
<script type="text/javascript">
29+
const paystackExample = {
30+
data() {
31+
return {
32+
33+
paystackkey: "pk_test_xxxxxxxxxxxxxxxxxxxxxx",
34+
35+
amount: 1000000,
36+
}
37+
},
38+
components: {
39+
'PayStack': Paystack.default
40+
},
41+
computed: {
42+
reference() {
43+
let text = "";
44+
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
45+
46+
for (let i = 0; i < 10; i++)
47+
text += possible.charAt(Math.floor(Math.random() * possible.length));
48+
49+
return text;
50+
}
51+
},
52+
methods: {
53+
callback: function (response) {
54+
console.log(response)
55+
},
56+
close: function () {
57+
console.log("Payment closed")
58+
}
59+
},
60+
61+
};
62+
Vue.createApp(paystackExample).mount('#app')
63+
</script>
64+
</body>
65+
66+
</html>

examples/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- Paystack example using Vue composition api -->
12
<html>
23

34
<head>

0 commit comments

Comments
 (0)