Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions docs/api/tab-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,9 @@ export const TabBarExample: React.FC = () => (
</ion-tabs>
</template>

<script>
<script setup lang="ts">
import { IonIcon, IonTabBar, IonTabButton, IonTabs } from '@ionic/vue';
import { call, person, settings } from 'ionicons/icons';
import { defineComponent } from 'vue';

export default defineComponent({
components: { IonIcon, IonTabBar, IonTabButton, IonTabs },
setup() {
return { call, person, settings }
}
});
</script>
```

Expand Down Expand Up @@ -176,4 +168,4 @@ import InsideTabBar from '@site/static/usage/v8/badge/inside-tab-bar/index.md';
<CustomProps />

## Slots
<Slots />
<Slots />
30 changes: 8 additions & 22 deletions docs/api/tab-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CustomProps from '@ionic-internal/component-api/v8/tab-button/custom-prop
import Slots from '@ionic-internal/component-api/v8/tab-button/slots.md';



import EncapsulationPill from '@components/page/api/EncapsulationPill';

<EncapsulationPill type="shadow" />
Expand Down Expand Up @@ -166,7 +166,7 @@ export const TabButtonExample: React.FC = () => (
</ion-tab-button>

<ion-tab-button tab="speakers" href="/tabs/speakers">
<ion-icon :icon="person-circle" aria-hidden="true"></ion-icon>
<ion-icon :icon="personCircle" aria-hidden="true"></ion-icon>
<ion-label>Speakers</ion-label>
</ion-tab-button>

Expand All @@ -183,29 +183,15 @@ export const TabButtonExample: React.FC = () => (
</ion-tabs>
</template>

<script>
import {
IonIcon,
IonLabel,
IonTabBar,
IonTabButton,
<script setup lang="ts">
import {
IonIcon,
IonLabel,
IonTabBar,
IonTabButton,
IonTabs
} from '@ionic/vue';
import { calendar, informationCircle, map, personCircle } from 'ionicons/icons';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonIcon,
IonLabel,
IonTabBar,
IonTabButton,
IonTabs
},
setup() {
return { calendar, informationCircle, map, personCircle }
}
});
</script>
```

Expand Down
42 changes: 15 additions & 27 deletions docs/developing/hardware-back-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,9 @@ import { useBackButton } from '@ionic/vue';

...

export default {
setup() {
useBackButton(10, () => {
console.log('Handler was called!');
});
}
}
useBackButton(10, () => {
console.log('Handler was called!');
});
```
</TabItem>
</Tabs>
Expand Down Expand Up @@ -236,19 +232,15 @@ import { useBackButton } from '@ionic/vue';

...

export default {
setup() {
useBackButton(5, () => {
console.log('Another handler was called!');
});
useBackButton(5, () => {
console.log('Another handler was called!');
});

useBackButton(10, (processNextHandler) => {
console.log('Handler was called!');
useBackButton(10, (processNextHandler) => {
console.log('Handler was called!');

processNextHandler();
});
}
}
processNextHandler();
});
```
</TabItem>
</Tabs>
Expand Down Expand Up @@ -385,16 +377,12 @@ import { App } from '@capacitor/app';

...

export default {
setup() {
const ionRouter = useIonRouter();
useBackButton(-1, () => {
if (!ionRouter.canGoBack()) {
App.exitApp();
}
});
const ionRouter = useIonRouter();
useBackButton(-1, () => {
if (!ionRouter.canGoBack()) {
App.exitApp();
}
}
});
```
</TabItem>
</Tabs>
Expand Down
14 changes: 2 additions & 12 deletions docs/updating/6-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,8 @@ This applies to `ion-action-sheet`, `ion-alert`, `ion-loading`, `ion-modal`, `io
<ion-tab-bar slot="bottom"> ... </ion-tab-bar>
</ion-tabs>

<script>
<script setup lang="ts">
import { IonTabs, IonTabBar } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: { IonTabs, IonTabBar },
});
</script>
```

Expand All @@ -214,13 +209,8 @@ This applies to `ion-action-sheet`, `ion-alert`, `ion-loading`, `ion-modal`, `io
<ion-tab-bar slot="bottom"> ... </ion-tab-bar>
</ion-tabs>

<script>
<script setup lang="ts">
import { IonTabs, IonTabBar, IonRouterOutlet } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: { IonTabs, IonTabBar, IonRouterOutlet },
});
</script>
```

Expand Down
79 changes: 35 additions & 44 deletions docs/vue/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,60 +22,51 @@ These lifecycles are only called on components directly mapped by a router. This
The lifecycles are defined the same way Vue lifecycle methods are - as functions at the root of your Vue component:

```tsx
<script setup lang="ts">
import { IonPage } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
name: 'Home',
ionViewDidEnter() {
console.log('Home page did enter');
},
ionViewDidLeave() {
console.log('Home page did leave');
},
ionViewWillEnter() {
console.log('Home page will enter');
},
ionViewWillLeave() {
console.log('Home page will leave');
},
components: {
IonPage,
},
});

const ionViewDidEnter = () => {
console.log('Home page did enter');
};

const ionViewDidLeave = () => {
console.log('Home page did leave');
};

const ionViewWillEnter = () => {
console.log('Home page will enter');
};

const ionViewWillLeave = () => {
console.log('Home page will leave');
};
</script>
```

### Composition API Hooks

These lifecycles can also be expressed using Vue 3's Composition API:

```tsx
<script setup lang="ts">
import { IonPage, onIonViewWillEnter, onIonViewDidEnter, onIonViewWillLeave, onIonViewDidLeave } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
name: 'Home',
components: {
IonPage,
},
setup() {
onIonViewDidEnter(() => {
console.log('Home page did enter');
});

onIonViewDidLeave(() => {
console.log('Home page did leave');
});

onIonViewWillEnter(() => {
console.log('Home page will enter');
});

onIonViewWillLeave(() => {
console.log('Home page will leave');
});
},

onIonViewDidEnter(() => {
console.log('Home page did enter');
});

onIonViewDidLeave(() => {
console.log('Home page did leave');
});

onIonViewWillEnter(() => {
console.log('Home page will enter');
});

onIonViewWillLeave(() => {
console.log('Home page will leave');
});
</script>
```

:::note
Expand Down
Loading
Loading