-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathdemo.html
More file actions
68 lines (67 loc) · 1.92 KB
/
demo.html
File metadata and controls
68 lines (67 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Picker Legacy | Controller</title>
<link rel="stylesheet" href="../../common.css" />
<script src="../../common.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@8/dist/ionic/ionic.esm.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@8/css/ionic.bundle.css" />
<script type="module">
import { pickerController } from 'https://cdn.jsdelivr.net/npm/@ionic/core@8/dist/ionic/index.esm.js';
window.pickerController = pickerController;
</script>
</head>
<body>
<ion-app>
<ion-content>
<div class="container">
<ion-button onclick="openPicker()">Open</ion-button>
</div>
</ion-content>
</ion-app>
<script>
async function openPicker() {
const picker = await pickerController.create({
columns: [
{
name: 'languages',
options: [
{
text: 'JavaScript',
value: 'javascript',
},
{
text: 'TypeScript',
value: 'typescript',
},
{
text: 'Rust',
value: 'rust',
},
{
text: 'C#',
value: 'c#',
},
],
},
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
},
{
text: 'Confirm',
handler: (value) => {
console.log(`You selected: ${value.languages.value}`);
},
},
],
});
await picker.present();
}
</script>
</body>
</html>