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

Vue.jsでクロス集計表を作る

 Vue.jsでクロス集計表を作る

第三回浜松IT合同勉強会でLTした資料です

jacoyutorius

June 10, 2017
Tweet

More Decks by jacoyutorius

Other Decks in Technology

Transcript

  1. About me • Yuto Ogi (খ໦ ༔ే) • @jacoyutorius •

    Ruby / Javascript / AWS / Vue.js / React Na@ve • (೥಺தʹAWSιϦϡʔγϣϯΞʔΩςΫτऔΓ͍ͨ) Hamamatsu / Kanazawa IT 4
  2. <div id="app"> <h2>{{message}}</h2> </div> <script type="text/javascript"> new Vue({ el: "#app",

    data: { message: "Hi, vue.js!" } }) </script> Hamamatsu / Kanazawa IT 10
  3. ࡞ͬͨ΋ͷ • ۙʑؔΘΓͦ͏ͳҊ݅ • ExcelͷϐϘοτςʔϒϧͰ࡞ۀ͍ͯͨ͠ࡏݿॲཧͷγεςϜ Խ (஍ཕष) • ΦʔμʔॲཧΛखೖྗ =>

    γεςϜԽ ͢Δ౎߹ͰɺExcelͰͷࡏ ݿॲཧ΋WebϕʔεͰߦ͏ඞཁ͕ − (·ͨ͸Excel VBAͰطଘExcelΛվम͢Δ͔) Hamamatsu / Kanazawa IT 13
  4. جຊܗ Vue.component('cell', { // ίϯϙʔωϯτͷ໊લ name: "cell", // ਌͔Β౉͞ΕͨϓϩύςΟ props:

    ["itemstock", "itemsum"], // දࣔ͢ΔHTML template: '<p v-bind:class="cellStyle">{{ this.itemOrderRemain() }}</p>', // Πϕϯτ methods: { itemOrderRemain: function(){ return parseInt(this.itemstock) - parseInt(this.itemsum); } } ) Hamamatsu / Kanazawa IT 18
  5. // inputcell: Φʔμʔ਺ೖྗηϧ Vue.component('inputCell', { name: "inputCell", props: ["username", "itemname",

    "userlevel", "itemprice", "order"], data: function(){ return { orderQty: this.order } }, template: '<div>' + '<input type="number" min="0" v-model="orderQty">' + '<button class="btn btn-sm btn-primary" v-on:click="onSave"></button>' + '</div>', methods: { onSave: function(){ app.updateOrder(this.itemname, this.username, this.orderQty); } } }) Hamamatsu / Kanazawa IT 19
  6. vue-cli browserifyͱwebpackͰΞϓϦέʔγϣϯͷϘΠϥʔϓϨʔτΛ࡞ ͬͯ͘ΕΔ vue list Available official templates: ˒ browserify

    - A full-featured Browserify + vueify setup with hot-reload, linting & unit testing. ˒ browserify-simple - A simple Browserify + vueify setup for quick prototyping. ˒ pwa - PWA template for vue-cli based on the webpack template ˒ simple - The simplest possible Vue setup in a single HTML file ˒ webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction. ˒ webpack-simple - A simple Webpack + vue-loader setup for quick prototyping. Hamamatsu / Kanazawa IT 26
  7. Code • Github • h(ps:/ /github.com/jacoyutorius/vue-pivot-table • Codepen • h(ps:/

    /codepen.io/jacoyutorius/pen/XgXKvr Hamamatsu / Kanazawa IT 29