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

Vim and Vuejs

Inndy
October 28, 2016

Vim and Vuejs

2016/10/28 at NTUOSC

Inndy

October 28, 2016
Tweet

More Decks by Inndy

Other Decks in Technology

Transcript

  1. /PSNBM.PEF ˙ ♶腋䩧㶶 ˙ 〳⟃獵⹛麉垦 ˙ 鱲䳖ⵌ*OTFSU.PEFJ P 0 B

    " T 4 D $ ˙ 鱲䳖ⵌ7JTVBM.PEFW 7 ?W ˙ ) + , -瘞倴̒ ̕ ̓ ̔렽⺑欽IKLM
  2. 鴾鸠獵⹛ ˙ X8騥♧⦐XPSE803% ˙ C#겳⡂X8⡎僽䖃⵹騥 ˙ ?E ?V1BHF%PXO 1BHF6Q ˙

    G ' 䖃䖕⵹锅ⵌ厥⦐㶶  ˙ U 5 騈G'䖎⫹⡎僽⨢㖈⵹♧⦐㶶 ˙ 獵⹛ㄐ⟂⵹〳⟃⸈♧⦐侸㶶⦔鸠獵⹛
  3. 俒㶶暟⟝ ˙ Ⰽ珏QSFYJ B JOOFS FOUJSF  ˙ X8XPSEㄤ803% ˙

    T4TFOUFODFㄤ4&/5&/$& ˙ Q1QBSBHSBQIㄤ1"3"(3"1) ˙ J J J< J J\ JB B B< B B\ B
  4. )FMMP 8PSME <div id="app"> <h1>{{message}}</h1> </div> <script src="vue.js"></script> <script> new

    Vue({ el: '#app', data: { message: 'Hello, World' } }) </script>
  5. 50%0-JTU <div id="app"> <ul v-if="todo.length > 0"> <li v-for="(item, index)

    in todo"> {{item}} <button @click="del(index)">X</button> </li> </ul> <p v-else>You dont have any TODO!</p> <div> <input type="text" v-model="to_add"> <button @click="add(to_add)">Add</button> </div> </div>
  6. 50%0-JTU new Vue({ el: '#app', data: { todo: [ 'Vue.js',

    'Hack the world' ], to_add: '' }, methods: { add: function (item) { this.todo.push(item) }, del: function (idx) { this.todo.splice(idx, 1) } } })
  7. 'JMUFS <div id="app"> {{ email | censor }} </div> <script>

    Vue.filter('censor', function (val ){ var l = (val.length / 3)|0 return (val.substr(0, l) + val.substr(l, l).replace(/./g, '*') + val.substr(l*2)) }) new Vue({ el: '#app', data: { email: '[email protected]' } }) </script>
  8. WVFDMJ莅XFCQBDL inndy ~$ vue init webpack my-vue-app This will install

    Vue 2.x version of template. For Vue 1.x use: vue init webpack#1.0 my-vue-app ? Project name my-vue-app ? Project description A Vue.js project ? Author Inndy <[email protected]> ? Vue build standalone ? Use ESLint to lint your code? Yes ? Pick an ESLint preset Standard ? Setup unit tests with Karma + Mocha? No ? Setup e2e tests with Nightwatch? No
  9. WVFDMJ莅XFCQBDL vue-cli · Generated "my-vue-app". To get started: cd my-vue-app

    npm install npm run dev Documentation can be found at 
 https://vuejs-templates.github.io/webpack
  10. WVFDMJ莅XFCQBDL inndy ~$ cd my-vue-app/ inndy my-vue-app$ yarn yarn install

    v0.15.1 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning Incorrect peer dependency "eslint-plugin- promise@>=3.3.0". [4/4] Building fresh packages... success Saved lockfile. ✨ Done in 24.25s. inndy my-vue-app$
  11. WVFDMJ莅XFCQBDL " Press ? for help | 1 import Vue

    from 'vue' | 2 import App from './App' .. (up a dir) | 3 </inndy/my-vue-app/ | 4 /* eslint-disable no-new */ ▸ build/ | 5 new Vue({ ▸ config/ | 6 el: '#app', ▾ src/ | 7 template: '<App/>', ▸ assets/ | 8 components: { App } ▾ components/ | 9 }) Hello.vue |~ App.vue |~ main.js |~ ▸ static/ |~ index.html |~ package.json |~ README.md |~ yarn.lock |~ ~ |~ ~ |~ ~ |~ ~ |~ ~ |~ <sers/inndy/my-vue-app src/main.js 1,1 獊蟂 "src/main.js" 9L, 146C
  12. WVFDMJ莅XFCQBDL inndy my-vue-app$ yarn dev yarn dev v0.15.1 $ node

    build/dev-server.js Listening at http://localhost:8080 webpack: wait until bundle finished: /index.html webpack built dbc14f94059ef4462d5f in 3242ms Hash: dbc14f94059ef4462d5f Version: webpack 1.13.3 Time: 3242ms Asset Size Chunks Chunk Names app.js 884 kB 0 [emitted] app index.html 252 bytes [emitted] Child html-webpack-plugin for "index.html": Asset Size Chunks Chunk Names index.html 1.46 MB 0 webpack: bundle is now VALID.
  13. 倞㟞$PNQPOFOU " Press ? for help | 1 <template> |

    2 <p>Hello, {{name}}. This is test component</p> .. (up a dir) | 3 </template> </inndy/my-vue-app/ | 4 ▸ build/ | 5 <script> ▸ config/ | 6 export default { ▾ src/ | 7 props: ['name'] ▸ assets/ | 8 } ▾ components/ | 9 </script> Hello.vue | 10 Test.vue | 11 <style scoped> App.vue | 12 * { color: red; } main.js | 13 </style> ▸ static/ |~ index.html |~ package.json |~ README.md |~ yarn.lock |~ ~ |~ ~ |~ ~ |~ <sers/inndy/my-vue-app src/components/Test.vue 1,1 獊蟂 "src/components/Test.vue" 13L, 172C
  14. 倞㟞$PNQPOFOU " Press ? for help | 1 <template> |

    2 <div id="app"> .. (up a dir) | 3 <img src="./assets/logo.png"> </inndy/my-vue-app/ | 4 <hello></hello> ▸ build/ | 5 <test name="Vue.js"></test> ▸ config/ | 6 </div> ▾ src/ | 7 </template> ▸ assets/ | 8 ▾ components/ | 9 <script> Hello.vue | 10 import Hello from './components/Hello' Test.vue | 11 import Test from './components/Test' App.vue | 12 main.js | 13 export default { ▸ static/ | 14 name: 'app', index.html | 15 components: { package.json | 16 Hello, Test README.md | 17 } yarn.lock | 18 } ~ | 19 </script> ~ | 20 ~ | 21 <style> <sers/inndy/my-vue-app src/App.vue 1,1 殸ᒒ "src/App.vue" 30L, 521C
  15. ♧럊㼭䊴殯 24 export default { 25 name: 'hello', 26 data

    () { 27 return { 28 msg: 'Welcome to Your Vue.js App' 29 } 30 } 31 }