1 of 13

Vue.js + Ionic = <3

@zwacky—Nov 2018

2 of 13

Overview

1) Current state @ionic/vue

2) How to get started

3) How does using it look like

4) Why would you use this?

5) Using Ionic as Web Components

6) Resources

3 of 13

1) Current state of @ionic/vue

  • Main project: @modus/ionic-vue
    • What does it cover
  • Merged into ionic project 3 weeks ago (24. Oct 2018)
    • Not released on NPM yet
  • Started with TypeScript support testing

4 of 13

2) How to get started

  • start up a new OR existing vue app

npx vue create hello-world

npm install @modus/ionic-vue

  • bootstrap code
  • ✨🎉

5 of 13

3) How does using it look like

  • Go to editor…
  • Other controllers
    • Action Sheet
    • Alert
    • Loading
    • Menu
    • Modal
    • Popover
    • Toast

6 of 13

4) Why would you use this?

Why we chose Vue.js

  • Our (JustWatch) specific requirements
    • Router:
      • easier customizable
      • for localized URLs
    • Compiler:
      • easier to compile injected HTML

7 of 13

5) Ionic as Web Components

  • A) Listen to events
  • B) Pass primitive type parameters
  • C) Pass over non-primitive type parameters
  • D) Call methods on Ionic components

8 of 13

A) Listening to Components

&

B) Passing primitive type parameters

<ion-searchbar� :showCancelButton="true"@ionInput="onInput($event)"@ionCancel="onCancel($event)">

</ion-searchbar>

onInput(evt) {

console.log(evt.target.value);

}

onCancel(evt) {

}

9 of 13

C) Passing non-primitive type parameters

<ion-slides� :options="{ loop: true }">

</ion-slides>

// or

<ion-slides� :options="myOptionsObject">

</ion-slides>

// => [object Object]

10 of 13

C) Passing non-primitive type parameters

<ion-slides� :options.prop="{ loop: true }">

</ion-slides>

// property binding necessary.

// for primitive types it’s

// enough to bind to attribute

// (:options=”…”)

// property vs attribute

// explanation

11 of 13

D) Call methods on Ionic components

<ion-slides� ref=”myName”>

</ion-slides>

<div class=”arrow-right”

@click=”next()”>

</div>

<script lang=”ts”>

next() {

this.$refs.myName.slideNext();

}

</script>

12 of 13

6) Resources

  • @modus/ionic-vue
  • beep (projects using @modus/ionic-vue)

Packages

  • Babel TSX/JSX transform

13 of 13

Thank you!