WEBã¨ã³ã¸ãã¢åå¼·ä¼ #03
WEBã¨ã³ã¸ãã¢åå¼·ä¼ #03
ã¯ããã« ãã㯠Rails ã® View 㨠Vue ã馴æã¾ããããã®è¨è¨æéã«ãªãã¾ãã Rails 5.1 㧠webpack ã Vue ãå ¬å¼ãµãã¼ãããã¾ãããSPA ã®å ´åã¯ãã¾ãæ°ã«ãªãã¾ããããã¹ã¿ã³ãã¼ã㪠Rails æ§æã« Vue ãé©ç¨ããå ´åã¯ãRails ã® View 㨠Vue ãã©ã®ããã«ç®¡çãã¹ããæ©ããã¨ã«ãªãã¨æãã¾ããæ¬è¨äºã«ã¯ãã®å¯¾å¦ä¾ãã¾ã¨ãã¦ãã¾ãã ç°å¢ Rails 5.1+ Turbolinks 5.0+ webpack 2.0+ Vue 2.0+ Vuex 2.0+ åè ãåç»ä»ããRails 5.1ã§ä½ãVue.jsã¢ããªã±ã¼ã·ã§ã³ ï½Herokuãããã¤ããã·ã¹ãã ãã¹ãã¾ã§ï½ - Qiita Rails 㨠Vue ã®å°å ¥ã«é¢ãã¦ã¯ããã¡ããåèã«ãªãã¾ãã ãã®å 容ãè¸ã¾ããä¸ã§ããã®å ã®è¨è¨å¨ãã«ã¤ãã¦èå¯ãã¦ããã¾ãã
æ¦è¦ Webpacker ãå©ç¨ãã¦Rails 5.1 + Vue.js ã§éçºãè¡ãæ¹æ³ãç´¹ä»ã æ¬è¨äºã§ã¯ãéçºç°å¢ãæ´ããã¾ã§è¡ã 次åã®è¨äºã§ã¯ãVue.js ã使ã£ã¦ Ajax éä¿¡ãè¡ãã¾ãã Rails 5.1 + Vue.js ã§éçºãè¡ã - part2 Ajax 㧠GET ãããï¼ãã確èªãã ãã å ¨ã³ã¼ãã¯ãã¡ããã確èªããã ãã¾ã ç°å¢ ruby 2.4.1 Rails 5.1.1 Vue 2.3.4 webpacker ã®ã¤ã³ã¹ãã¼ã« ã¯ããã« webpacker ã install ãã¾ãã â» Rails ã¢ããªããã§ã«ä½ææ¸ã¿ã¨ããåæã§è©±ãé²ãã¾ãã webpacker ã¨ã¯ Webpacker makes it easy to use the JavaScript pre-processor and bundler Webpack 2.x.x+ to
ã¯ããã« Railsã§ã¢ããªã±ã¼ã·ã§ã³ãéçºãã¦ããã¨ãE2Eã®è©¦é¨ã¨ãã¦feature specãæ¸ããã¨ã¯ããããã¨æãã¾ãããJavaScriptã§å®è£ ããããã³ãã¨ã³ãã®ã¢ã¸ã¥ã¼ã«ãã©ã¤ãã©ãªã®ã¦ããããã¹ãã¯ãfeature specããããã大ä¸å¤«ãã¨ãããªãã«ãªã£ã¦ãã¾ãããï¼E2Eãã¹ãã§ãã¹ã¦ç¶²ç¾ çã«æ¤è¨¼ã§ãã¦ããã°è¯ãã¨ããæè¦ã«ã¯ä¸çããã®ã§ãããUIãUXãã¯ããã¨ãã¦ãããã³ãã¨ã³ãã®è¦ä»¶ã大ããè¤éã«ãªãå¾åã«ããæè¿ã®WEBã¢ããªã±ã¼ã·ã§ã³ã«ããã¦ã¯ãããã³ãã¨ã³ãã®ã¦ããããã¹ãããããã¨ã®ã¡ãªããã¯å¤§ããã¨èãã¦ãã¾ããã¾ãfeature specã¯ãã¦ãã¦å®è¡æéãé·ããã¦ã¼ã¶ã¼ã®æä½ãã¿ã¼ã³ããã¹ã¦ç¶²ç¾ çã«æ¤è¨¼ããã®ã¯ç¾å®çã§ã¯ããã¾ããã ä»åã®è¨äºã§ã¯ãããã¯ã¨ã³ãã®ãã¬ã¼ã ã¯ã¼ã¯ã¨ãã¦Railsãããã³ãã¨ã³ãã®ãã¬ã¼ã ã¯ã¼ã¯ã¨ãã¦Vue.jsã
<div id="ex-sortable"> <ul v-component="v-sortable" v-with="model: list"></ul> </div> <template id="sort-template"> <li v-repeat="model">{{$value}}</li> </template> Vue.component('v-sortable', { template: "#sort-template", ready: function() { var self = this; $(this.$el).sortable({ opacity: 0.6, start: function(e, ui) { ui.item.data('from', ui.item.index()); }, update: function(e, ui) { var from =
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}