You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`ion-header` represents the top navigation and toolbar, with "Tab 2" as the title. Let’s rename it:
200
+
`ion-header` represents the top navigation and toolbar, with "Tab 2" as the title (there are two of them due to iOS [Collapsible Large Title](https://ionicframework.com/docs/api/title#collapsible-large-titles) support). Rename both `ion-title` elements to:
152
201
153
202
```html
154
203
<ion-title>Photo Gallery</ion-title>
155
204
```
156
205
157
-
We put the visual aspects of our app into `<ion-content>`. In this case, it’s where we’ll add a button that opens the device’s camera as well as displays the image captured by the camera. But first, remove the `ExploreContainer` component, beginning with the import statement:
Next, remove the `ExploreContainer` node from the HTML markup in the `template`.
206
+
We put the visual aspects of our app into `<ion-content>`. In this case, it’s where we’ll add a button that opens the device’s camera as well as displays the image captured by the camera. But first, remove both the `ExploreContainer` component and its import statement:
164
207
165
208
```html
166
-
<ExploreContainername="Tab 2 page" />
209
+
<template>
210
+
<ion-page>
211
+
<ion-header>
212
+
<ion-toolbar>
213
+
<ion-title>Photo Gallery</ion-title>
214
+
</ion-toolbar>
215
+
</ion-header>
216
+
<ion-content:fullscreen="true">
217
+
<ion-headercollapse="condense">
218
+
<ion-toolbar>
219
+
<ion-titlesize="large">Photo Gallery</ion-title>
220
+
</ion-toolbar>
221
+
</ion-header>
222
+
<!-- CHANGE: Remove or comment out <ExploreContainer /> -->
// CHANGE: Remove or comment out ExploreContainer import.
231
+
// import ExploreContainer from '@/components/ExploreContainer.vue';
232
+
</script>
167
233
```
168
234
169
235
We'll replace it with a [floating action button](https://ionicframework.com/docs/api/fab) (FAB). First, update the imports within the `<script setup>` tag to include the Camera icon as well as some of the Ionic components we'll use shortly:
170
236
171
-
```tsx
237
+
```html
238
+
<template>
239
+
<ion-page>
240
+
<ion-header>
241
+
<ion-toolbar>
242
+
<ion-title>Photo Gallery</ion-title>
243
+
</ion-toolbar>
244
+
</ion-header>
245
+
<ion-content:fullscreen="true">
246
+
<ion-headercollapse="condense">
247
+
<ion-toolbar>
248
+
<ion-titlesize="large">Photo Gallery</ion-title>
249
+
</ion-toolbar>
250
+
</ion-header>
251
+
</ion-content>
252
+
</ion-page>
253
+
</template>
254
+
255
+
<scriptsetuplang="ts">
256
+
// CHANGE: Add import from `ionicons/icons`
172
257
import { camera, trash, close } from'ionicons/icons';
258
+
// CHANGE: Update import from `@ionic/vue` to include necessary Ionic components
173
259
import {
174
260
IonPage,
175
261
IonHeader,
@@ -184,37 +270,92 @@ import {
184
270
IonCol,
185
271
IonImg,
186
272
} from'@ionic/vue';
273
+
</script>
187
274
```
188
275
189
276
Since our pages are generated as [Vue Single File Components](https://vuejs.org/api/sfc-spec.html) using the [`<script setup>`](https://vuejs.org/api/sfc-script-setup.html#script-setup) syntax these items are now exposed for use in our template.
190
277
191
278
Add the FAB to the bottom of the page. Use the camera image as the icon, and call the `takePhoto()` function when this button is clicked (to be implemented soon):
Within the tab bar (`<ion-tab-bar>`), change the label to "Photos" and the `ellipse` icon to `images` for the middle tab button:
325
+
Next, open `src/views/TabsPage.vue`. Remove the `ellipse` icon from the import and import the `images` icon instead. Then, within the tab bar (`<ion-tab-bar>`), change the label to "Photos" and the `ellipse` icon to `images` for the middle tab button:
212
326
213
327
```html
214
-
<ion-tab-buttontab="tab2"href="/tabs/tab2">
215
-
<ion-icon:icon="images" />
216
-
<ion-label>Photos</ion-label>
217
-
</ion-tab-button>
328
+
<template>
329
+
<ion-page>
330
+
<ion-tabs>
331
+
<ion-router-outlet></ion-router-outlet>
332
+
<ion-tab-barslot="bottom">
333
+
<ion-tab-buttontab="tab1"href="/tabs/tab1">
334
+
<ion-iconaria-hidden="true":icon="triangle" />
335
+
<ion-label>Tab 1</ion-label>
336
+
</ion-tab-button>
337
+
338
+
<ion-tab-buttontab="tab2"href="/tabs/tab2">
339
+
<!-- CHANGE: Replace `ellipse` icon with `images` -->
That’s just the start of all the cool things we can do with Ionic. Up next, implementing camera taking functionality on the web, then building for iOS and Android.
0 commit comments