Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vue Native でアプリ開発

TakeshiNishi
January 30, 2019

Vue Native でアプリ開発

Vue Night #2 LT資料です。
Vue Native でアプリ開発しての感想。
ネイティブやろうと思ったきっかけとなったPWA開発の話。
Nuxt.js 2.4でリリースされた機能の紹介です。

TakeshiNishi

January 30, 2019
Tweet

More Decks by TakeshiNishi

Other Decks in Programming

Transcript

  1. ੢෢࢙ גࣜձࣾEJ⒎FBTZ
 औక໾$50 !@UBLFTIJ@ 'JSFCBTF 7VF (PMBOH 3VCZ ($1 ϒϩοΫνΣʔϯ

    EPDLFS /VYU &MJYJS Թઘ ϥϯχϯά -5͓͡͞Μ ಡॻ ম೑͓͡͞Μ
  2. /VYUKTͰ18"ରԠ $ yarn add @nuxtjs/pwa --save  !OVYUKTQXBΛΠϯετʔϧ modules: [

    '@nuxtjs/dotenv', '@nuxtjs/pwa' ], manifest: { name: 'wacha', short_name: 'wacha', title: 'wacha', lang: 'ja', gcm_sender_id: '103953800507' //ݻఆ஋ },  OVYUDPOpHKTʹΞϓϦͷ৘ใΛ௥Ճ
  3. <template> <view class="container"> <text-input :style="{
 height: 40, width: 200,
 borderColor:

    'gray', borderWidth: 1
 }" v-model="messageText" /> <button :on-press="saveMessage" title="Save" /> <text v-for="(message, index) in messages" :key="index">{{ message }}</text> </view> </template> αϯϓϧιʔε UFNQMBUF
  4. <script> export default { data: function() { return { messageText:

    '', messages: [] } }, methods: { saveMessage: function() { this.messages.push(this.messageText) this.messageText = '' } } } </script> αϯϓϧιʔε TDSJQU
  5. const state = { messages: [] } const getters =

    { messages: state => { return state.messages } } const actions = { addMessage ({ commit }, message) { commit('addMessage', message) } } const mutations = { addMessage (state, message) { state.messages.push(message) } } export default { state, getters, actions, mutations } 7VFY΋ར༻Մೳ
  6. <script> import Store from './store'; export default { data: function()

    { return { messageText: '' } }, computed: { messages: function() { return Store.getters.messages } }, methods: { saveMessage: function() { Store.dispatch('addMessage', this.messageText) this.messageText = '' } } } </script> 7VFY΋ར༻Մೳ
  7. <template> <app-navigation></app-navigation> </template> <script> import { StackNavigator } from "vue-native-router";

    import HomeScreen from "./screens/HomeScreen.vue"; import MessagesScreen from "./screens/MessagesScreen.vue"; const AppNavigation = StackNavigator( { Home: HomeScreen, Messages: MessagesScreen, }, { initialRouteName: 'Home', } ); export default { components: { AppNavigation } } </script> 7VF/BUJWF3PVUFSͰը໘ભҠ "QQWVF
  8. <script> export default { data: function() { return { text:

    'Home' } }, props: { navigation: { type: Object } }, methods: { goMessages: function() { this.navigation.navigate("Messages") } } } </script> 7VF/BUJWF3PVUFSͰը໘ભҠ )PNFWVF