ã¬ã¤ã
åºæ¬çãªä½¿ãæ¹
- ã¤ã³ã¹ãã¼ã«
- ã¯ããã«
- Vue ã¤ã³ã¹ã¿ã³ã¹
- ãã³ãã¬ã¼ãæ§æ
- ç®åºããããã£ã¨ã¦ã©ããã£
- ã¯ã©ã¹ã¨ã¹ã¿ã¤ã«ã®ãã¤ã³ãã£ã³ã°
- æ¡ä»¶ä»ãã¬ã³ããªã³ã°
- ãªã¹ãã¬ã³ããªã³ã°
- ã¤ãã³ããã³ããªã³ã°
- ãã©ã¼ã å ¥åãã¤ã³ãã£ã³ã°
- ã³ã³ãã¼ãã³ãã®åºæ¬
ã³ã³ãã¼ãã³ãã®è©³ç´°
- ã³ã³ãã¼ãã³ãã®ç»é²
- ããããã£
- ã«ã¹ã¿ã ã¤ãã³ã
- ã¹ããã
- åç & éåæã³ã³ãã¼ãã³ã
- ç¹å¥ãªåé¡ã«å¯¾å¦ãã
ãã©ã³ã¸ã·ã§ã³ã¨ã¢ãã¡ã¼ã·ã§ã³
- Enter/Leave ã¨ãã©ã³ã¸ã·ã§ã³ä¸è¦§
- ç¶æ ã®ãã©ã³ã¸ã·ã§ã³
åå©ç¨ã¨æ§æ
- ããã¯ã¹ã¤ã³
- ã«ã¹ã¿ã ãã£ã¬ã¯ãã£ã
- æç»é¢æ°ã¨JSX
- ãã©ã°ã¤ã³
- ãã£ã«ã¿ã¼
ãã¼ã«
- åä¸ãã¡ã¤ã«ã³ã³ãã¼ãã³ã
- ãã¹ã
- TypeScript ã®ãµãã¼ã
- ãããã¯ã·ã§ã³ç°å¢ã¸ã®é ä¿¡
ã¹ã±ã¼ã«ã¢ãã
- ã«ã¼ãã£ã³ã°
- ç¶æ 管ç
- ãµã¼ããµã¤ãã¬ã³ããªã³ã°
- ã»ãã¥ãªãã£
å é¨
- ãªã¢ã¯ãã£ãã®æ¢æ±
移è¡
- Vue 1.x ããã®ç§»è¡
- Vue Router 0.7.x ããã®ç§»è¡
- Vuex 0.6.x ãã 1.0 ã¸ã®ç§»è¡
ãã®ä»
- ä»ã®ãã¬ã¼ã ã¯ã¼ã¯ã¨ã®æ¯è¼
- Vue.js ã³ãã¥ããã£ã¸åå ãã¾ããã!
- ãã¼ã ã«ä¼ãã
v2.x 以åã®ããã¥ã¡ã³ãã§ãã v3.x ã®ããã¥ã¡ã³ããè¦ããå ´åã¯ãã¡ã
åä¸ãã¡ã¤ã«ã³ã³ãã¼ãã³ã
æçµæ´æ°æ¥: 2019å¹´9æ22æ¥
åæ¸ã
å¤ãã® Vue ããã¸ã§ã¯ãã§ã¯ãã°ãã¼ãã«ã³ã³ãã¼ãã³ãã¯ãnew Vue({ el: '#container '})
ã®å¾ã«åãã¼ã¸ã® body ã«ããã¦ã³ã³ããè¦ç´ ãã¿ã¼ã²ããã«ãããã¨ã«ç¶ãã¦ãVue.component
ã使ç¨ãã¦å®ç¾©ããã¦ãã¾ãã
ãã㯠view ãæ¡å¼µããã ãã«å©ç¨ãããå°ããªä¸è¦æ¨¡ããã¸ã§ã¯ãã«ããã¦ã¯ã¨ã¦ãæå¹ã§ãã ããªãã®ããã³ãã¨ã³ã㧠JavaScript å ¨ä½ãæä½ãããããªãã£ã¨è¤éãªããã¸ã§ã¯ãã§ã¯ããããã®ç¹ã«ããã¦ä¸å©çã«ãªããã¨ã¯æç½ã§ãã:
- ã°ãã¼ãã«å®£è¨ã¯å ¨ã¦ã®ã³ã³ãã¼ãã³ãã«ä¸æãªååãå¼·å¶ãããã¨
- ã·ã³ã¿ãã¯ã¹ãã¤ã©ã¤ãã®ç¡ãæååãã³ãã¬ã¼ãã¨è¤æ°è¡ HTML ã®æã«éãã¹ã©ãã·ã¥ãå¼·è¦ããããã¨
- CSS ãµãã¼ãç¡ãã ã¨ã HTML 㨠JavaScript ãã³ã³ãã¼ãã³ãã«ã¢ã¸ã¥ã¼ã«åããã¦ããéãããè¦ãããã«ç¡è¦ããããã¨
- ãã«ãå¦çããªã㨠Pug (å Jade) ã Babel ã®ãããªããªããã»ããµãããããã HTML ã ES5 JavaScript ãå¶éããããã¨
ãããå
¨ã¦ã¯ Webpack ã Browserify ã®ãã«ããã¼ã«ã«ããå®ç¾ããã .vue
æ¡å¼µåã® åä¸ãã¡ã¤ã«ã³ã³ãã¼ãã³ã ã§è§£æ±ºãã¾ãã
ãã¡ãã Hello.vue
ã¨å¼ã°ãããã¡ã¤ã«ã®åç´ãªä¾ã§ã:
ãã¦æ¬¡ã«ãã¡ãã«å ¥ãã¾ã:
- å®å ¨çã·ã³ã¿ãã¯ã¹ãã¤ã©ã¤ã
- CommonJS ã¢ã¸ã¥ã¼ã«
- ã³ã³ãã¼ãã³ãã¹ã³ã¼ã CSS
ç´æããã¨ããã Pugã Babel(ES2015 ã¢ã¸ã¥ã¼ã«ã¨ä¸ç·ã«ï¼ã Stylus ãªã©ããç¾ãããã¤æ©è½ãè±å¯ãªã³ã³ãã¼ãã³ããããªããã»ããµã¨ãã¦å©ç¨ã§ãã¾ãã
ãããã®ç¹å®ã®è¨èªã¯åãªãä¸ä¾ã§ããBuble ãTypeScript ãSCSS ãPostCSS ãªã©ã®çç£çãªããªããã»ããµãç°¡åã«ä½¿ããã¨ãã§ãã¾ããvue-loader
㧠Webpack ã使ç¨ãã¦ãããªãã°ãCSS Modules åãã«ç´ æ´ããããµãã¼ããããã¾ãã
é¢å¿ã®åé¢ã«ã¤ãã¦
注æãã¹ãéè¦ãªç¹ã®1ã¤ã¯ãé¢å¿äºé ã®åé¢ããã¡ã¤ã«ã¿ã¤ãã®åé¢ã¨çãããªããã¨ã§ãã ç¾ä»£ã® UI éçºã§ã¯ãã³ã¼ããã¼ã¹ãäºãã«ç¹ã交ãã3ã¤ã®å·¨å¤§ãªã¬ã¤ã¤ã¼ã«åå²ããã®ã§ã¯ãªããããããççµåãªã³ã³ãã¼ãã³ãã«åå²ãã¦æ§æããæ¹ãã¯ããã«çã«ããªã£ã¦ãã¾ããã³ã³ãã¼ãã³ãã®å é¨ã§ã¯ããã®ãã³ãã¬ã¼ãããã¸ãã¯ãã¹ã¿ã¤ã«ãæ¬è³ªçã«çµåããã¦ãããå®éã«ããããé ç½®ãããã¨ã§ãã³ã³ãã¼ãã³ããããä¸è²«æ§ã¨ä¿å®æ§ã«åªãã¦ãã¾ãã
åä¸ãã¡ã¤ã«ã³ã³ãã¼ãã³ãã®ã¢ã¤ãã¢ãæ°ã«å ¥ããªãã¦ããJavaScript 㨠CSS ãå¥ã ã®ãã¡ã¤ã«ã«åãããã¨ã§ãããããªãã¼ãã¨ããªã³ã³ãã¤ã«æ©è½ãæ´»ç¨ã§ãã¾ã:
<!-- my-component.vue -->
<template>
<div>This will be pre-compiled</div>
</template>
<script src="./my-component.js"></script>
<style src="./my-component.css"></style>
ã¯ããã
ãµã³ãããã¯ã¹ã®ä¾
ããã«è§¦ã£ã¦ããã¦åä¸ãã¡ã¤ã«ã³ã³ãã¼ãã³ãã試ãããå ´åã¯ãCodeSandbox ä¸ã®ãã®åç´ãª todo ã¢ããªã±ã¼ã·ã§ã³ ããã§ãã¯ãã¦ãã ããã
JavaScript ã§ã¢ã¸ã¥ã¼ã«ãã«ãã·ã¹ãã ãåãã¦ãªã¦ã¼ã¶ã¼åã
.vue
ã³ã³ãã¼ãã³ãã«ãããé«åº¦ãª JavaScript ã¢ããªã±ã¼ã·ã§ã³ã®åéã«å
¥ã£ã¦ããã¾ããããã¯ããªããã¾ã 使ã£ããã¨ã®ãªããããã¤ãã®è¿½å ãã¼ã«ã®ä½¿ãæ¹ãå¦ã¶ãã¨ãæå³ãã¾ãã
Node Package Manager (NPM): ã¬ã¸ã¹ããªããããã±ã¼ã¸ãåå¾ããæ¹æ³ã«ã¤ãã¦ã¯ã Getting Started guide ã®ã»ã¯ã·ã§ã³ãèªãã§ãã ããã
Modern JavaScript with ES2015/16: Babel ã® Learn ES2015 guide ãèªãã§ãã ãããç¾ç¶ã§ã¯å ¨ã¦ã®æ©è½ãæè¨ããå¿ è¦ã¯ãªãã§ãããåèã¨ãã¦æ»ããããã«ãã¦ããã¦ãã ããã
ãããã®ãªã½ã¼ã¹ã«æ²¡é ããå¾ã¯ã Vue CLI 3 ã確èªãããã¨ããå§ããã¾ããæé ã«æ²¿ã£ã¦å¦ç¿ãããã¨ã§ããã£ã¨ããéã« .vue
ã³ã³ãã¼ãã³ã㨠ES2015ãWebpackãããããªãã¼ãã£ã³ã°ãããªãã Vue ããã¸ã§ã¯ããæã«å
¥ããããã¯ãã§ãï¼
ä¸ç´è ã¦ã¼ã¶ã¼åã
CLI ã¯ãã¼ã«è¨å®ã®å¤§é¨åã®é¢åãè¦ã¦ããã¾ããã è¨å®ãªãã·ã§ã³ ãéãã¦ããç´°ããªã«ã¹ã¿ãã¤ãºããããã¨ãã§ãã¾ãã
ããªããç¬èªã®ãã«ãã»ããã¢ãããã¼ãããä½ããã¨ã好ãå ´åãwebpack 㨠vue-loader ãæåã§è¨å®ããå¿ è¦ãããã§ããããwebpack èªä½ã«ã¤ãã¦ããã«å¦ã¶ã«ã¯ãå ¬å¼ããã¥ã¡ã³ãã Webpack Academy ãåç §ãã¦ãã ããã