Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(playgrounds): use Vue's script setup syntax #3328

Draft
wants to merge 58 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
71ddb11
accordion
mapsandapps Sep 1, 2023
e139adf
action-sheet
mapsandapps Sep 1, 2023
f7d213c
Update playground template
mapsandapps Sep 7, 2023
4367cfa
backdrop
mapsandapps Dec 14, 2023
3a6db20
badge
mapsandapps Dec 14, 2023
3f52485
breadcrumbs
mapsandapps Dec 14, 2023
6669972
button
mapsandapps Dec 14, 2023
4b14c62
buttons
mapsandapps Dec 14, 2023
ac9c1d9
card
mapsandapps Dec 14, 2023
4674420
checkbox
mapsandapps Dec 14, 2023
0e91ee3
chip
mapsandapps Dec 14, 2023
5be175e
content
mapsandapps Dec 14, 2023
7b5a625
datetime
mapsandapps Dec 14, 2023
ae73d34
fab
mapsandapps Dec 14, 2023
ac34cd2
footer
mapsandapps Dec 14, 2023
c1e79b7
grid
mapsandapps Dec 14, 2023
b59188f
header
mapsandapps Dec 14, 2023
e2216af
icon
mapsandapps Dec 14, 2023
0c959ed
img
mapsandapps Dec 14, 2023
bc71b76
infinite-scroll
mapsandapps Dec 14, 2023
0e75efe
input
mapsandapps Dec 14, 2023
11004f4
item
mapsandapps Dec 15, 2023
00ca0cb
item-divider
mapsandapps Dec 15, 2023
c0dad46
item-group
mapsandapps Dec 15, 2023
7cb8ef8
label
mapsandapps Dec 15, 2023
78d5eec
list
mapsandapps Dec 15, 2023
980f6c5
list-header
mapsandapps Dec 15, 2023
f630b75
loading
mapsandapps Dec 15, 2023
ab31953
menu
mapsandapps Dec 15, 2023
037efca
nav: nav-link
mapsandapps Dec 15, 2023
ae5b161
note
mapsandapps Dec 15, 2023
e551846
picker
mapsandapps Dec 15, 2023
311bf82
popover
mapsandapps Dec 15, 2023
72bc39c
radio
mapsandapps Dec 15, 2023
ca8646a
range
mapsandapps Dec 15, 2023
b817e5d
refresher
mapsandapps Dec 15, 2023
d60f494
reorder
mapsandapps Dec 15, 2023
385f4b5
ripple-effect
mapsandapps Dec 15, 2023
2b91117
searchbar
mapsandapps Dec 15, 2023
df2e759
segment
mapsandapps Dec 15, 2023
d45f6ae
segment-button
mapsandapps Dec 15, 2023
c37baab
select
mapsandapps Dec 15, 2023
585691c
skeleton-text
mapsandapps Dec 15, 2023
73d1a51
spinner
mapsandapps Dec 15, 2023
b20a8a7
split-pane
mapsandapps Dec 15, 2023
369506e
tabs
mapsandapps Dec 15, 2023
6ccfaad
text
mapsandapps Dec 15, 2023
27b4b12
textarea
mapsandapps Dec 15, 2023
d2f334a
thumbnail
mapsandapps Dec 15, 2023
9f74da6
title
mapsandapps Dec 15, 2023
0dcb673
toast
mapsandapps Dec 15, 2023
cfcc61c
toggle
mapsandapps Dec 15, 2023
559b5ea
toolbar
mapsandapps Dec 15, 2023
811936f
refactor: `<ion-avatar />`
icarusgk Sep 15, 2023
22c2363
refactor: `<ion-back-button />`
icarusgk Sep 16, 2023
c0f1a98
lint
mapsandapps Dec 15, 2023
d0aeb8f
modal
mapsandapps Dec 15, 2023
faed9d1
progress-bar
mapsandapps Dec 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 1 addition & 8 deletions _templates/playground/new/vue.md.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@ to: "<%= `static/usage/v${version}/${name}/${path}/vue.md` %>"
<<%= component %>></<%= component %>>
</template>

<script lang="ts">
<script lang="ts" setup>
import { <%= pascalComponent %> } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
<%= pascalComponent %>,
},
});
</script>
<% if (css){ -%>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/toast.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Toasts can be swiped to dismiss by using the `swipeGesture` property. This featu
import SwipeGesture from '@site/static/usage/v7/toast/swipe-gesture/index.md';

<SwipeGesture />

## Layout

Button containers within the toast can be displayed either on the same line as the message or stacked on separate lines using the `layout` property. The stacked layout should be used with buttons that have long text values. Additionally, buttons in a stacked toast layout can use a `side` value of either `start` or `end`, but not both.
Expand Down
11 changes: 1 addition & 10 deletions static/usage/v7/accordion/accessibility/animations/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel, AccordionGroupCustomEvent } from '@ionic/vue';
import { defineComponent, ref } from 'vue';
export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
12 changes: 1 addition & 11 deletions static/usage/v7/accordion/basic/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,8 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>

<style scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
15 changes: 1 addition & 14 deletions static/usage/v7/accordion/customization/icons/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,8 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { caretDownCircle } from 'ionicons/icons';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
setup() {
return { caretDownCircle };
},
});
</script>
```
15 changes: 1 addition & 14 deletions static/usage/v7/accordion/customization/theming/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,9 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { caretDownCircle } from 'ionicons/icons';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
setup() {
return { caretDownCircle };
},
});
</script>

<style>
Expand Down
11 changes: 1 addition & 10 deletions static/usage/v7/accordion/disable-group/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel, AccordionGroupCustomEvent } from '@ionic/vue';
import { defineComponent, ref } from 'vue';
export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
11 changes: 1 addition & 10 deletions static/usage/v7/accordion/disable/group/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel, AccordionGroupCustomEvent } from '@ionic/vue';
import { defineComponent, ref } from 'vue';
export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
11 changes: 1 addition & 10 deletions static/usage/v7/accordion/disable/individual/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel, AccordionGroupCustomEvent } from '@ionic/vue';
import { defineComponent, ref } from 'vue';
export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
33 changes: 9 additions & 24 deletions static/usage/v7/accordion/listen-changes/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,17 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel, AccordionGroupCustomEvent } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
setup() {
const values = ['first', 'second', 'third'];
const accordionGroupChange = (ev: AccordionGroupCustomEvent) => {
const collapsedItems = values.filter((value) => value !== ev.detail.value);
const selectedValue = ev.detail.value;
const values = ['first', 'second', 'third'];
const accordionGroupChange = (ev: AccordionGroupCustomEvent) => {
const collapsedItems = values.filter((value) => value !== ev.detail.value);
const selectedValue = ev.detail.value;

console.log(
`Expanded: ${selectedValue === undefined ? 'None' : ev.detail.value} | Collapsed: ${collapsedItems.join(
', '
)}`
);
};

return { accordionGroupChange };
},
});
console.log(
`Expanded: ${selectedValue === undefined ? 'None' : ev.detail.value} | Collapsed: ${collapsedItems.join(', ')}`
);
};
</script>
```
12 changes: 1 addition & 11 deletions static/usage/v7/accordion/multiple/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
12 changes: 1 addition & 11 deletions static/usage/v7/accordion/readonly/group/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
12 changes: 1 addition & 11 deletions static/usage/v7/accordion/readonly/individual/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@
</ion-accordion-group>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonItem, IonLabel } from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonItem,
IonLabel,
},
});
</script>
```
41 changes: 14 additions & 27 deletions static/usage/v7/accordion/toggle/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,22 @@
<ion-button @click="toggleAccordion()">Toggle Second Accordion</ion-button>
</template>

<script lang="ts">
<script lang="ts" setup>
import { IonAccordion, IonAccordionGroup, IonButton, IonItem, IonLabel } from '@ionic/vue';
import { defineComponent, ref } from 'vue';
import { ref } from 'vue';

export default defineComponent({
components: {
IonAccordion,
IonAccordionGroup,
IonButton,
IonItem,
IonLabel,
},
setup() {
const accordionGroup = ref(null);
const toggleAccordion = () => {
if (!accordionGroup.value) {
return;
}
const nativeEl = accordionGroup.value.$el;
const accordionGroup = ref(null);
const toggleAccordion = () => {
if (!accordionGroup.value) {
return;
}
const nativeEl = accordionGroup.value.$el;

if (nativeEl.value === 'second') {
nativeEl.value = undefined;
} else {
nativeEl.value = 'second';
}
};

return { accordionGroup, toggleAccordion };
},
});
if (nativeEl.value === 'second') {
nativeEl.value = undefined;
} else {
nativeEl.value = 'second';
}
};
</script>
```
Loading