<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pinyo Tadsomboon on Medium]]></title>
        <description><![CDATA[Stories by Pinyo Tadsomboon on Medium]]></description>
        <link>https://medium.com/@pinyo7777777?source=rss-2d74647e97de------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*cccZnaihUwSCtK6kH35IUA.jpeg</url>
            <title>Stories by Pinyo Tadsomboon on Medium</title>
            <link>https://medium.com/@pinyo7777777?source=rss-2d74647e97de------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:36:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pinyo7777777/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[การทำระบบ Real time ด้วย Socket.io ใน Vue.js + Node.js]]></title>
            <link>https://medium.com/lffintech/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%B3%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A-real-time-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-socket-io-%E0%B9%83%E0%B8%99-vue-js-node-js-5cdad2319331?source=rss-2d74647e97de------2</link>
            <guid isPermaLink="false">https://medium.com/p/5cdad2319331</guid>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Pinyo Tadsomboon]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 17:18:37 GMT</pubDate>
            <atom:updated>2021-10-08T14:47:37.714Z</atom:updated>
            <content:encoded><![CDATA[<p>ในปัจจุบันนั้นมีการใช้ <strong>Real time</strong> กันอย่างแพร่หลาย เช่น ระบบแชท, ระบบทางการแพทย์, ระบบตลาดหุ้น เป็นต้น <strong>Real time</strong> หรือ ระบบปฏิบัติการเวลาจริง นั้นคือระบบที่สามารถทำการตอบสนองจากระบบอย่างทันที เมื่อมีการเรียกใช้งานหรือส่งข้อมูลมายัง <strong>Real time server </strong>ก็จะทำการส่งข้อมูลกลับไปยัง<strong> Client </strong>ทั้งหมดที่ได้ทำการเชื่อมต่ออยู่กับ <strong>Real time server</strong></p><p>ในวันนี้เราจะมาทดลองทำระบบ <strong>Real time</strong> แบบง่าย ๆ กันครับซึ่งเราจะใช้ <strong>Library</strong> ที่ชื่อว่า <strong>Socket.io</strong> ในการทำระบบ <strong>Real time</strong> แต่ก่อนอื่นเรามาทำความรู้จักกับ <strong>Socket.io </strong>กันก่อนครับ</p><p><strong>Socket.io</strong> คือ <strong>Library</strong> ตัวหนึ่งที่เราใช้จัดการกับระบบ <strong>Real time</strong> ซึ่งจะทำการสร้าง <strong>Real time Server</strong> ขึ้นมาซึ่งจะทำการเปิดช่องไว้เพื่อให้ฝั่ง <strong>Client </strong>ทำการส่งข้อมูลมายัง <strong>Real time Server</strong> และทางฝั่งของ <strong>Client </strong>ก็จะทำการเปิดช่องเพื่อรอรับข้อมูลที่จะตอบกลับมายัง<strong> Real time Server </strong>เมื่อมีการส่งข้อมูลมาจากฝั่ง<strong> Client เ</strong>ครื่องใดเครื่องหนึ่ง ก็จะทำการตอบกลับไปยัง<strong> Client </strong>ที่ได้ทำการเชื่อมต่อและเปิดช่องที่<strong> Real time Server </strong>จะทำการส่งข้อมูลมารอไว้ หากใครที่ยังไม่ค่อยเข้าใจให้ดูจากภาพด้านล่างประกอบครับ จะเห็นว่ามีการส่งข้อมูลจาก <strong>Client </strong>เครื่องหนึ่งมายัง <strong>Real time Server </strong>และได้ทำการตอบกลับไปยัง<strong> Client </strong>ทุกเครื่องที่ได้ทำการเชื่อมต่อรวมเครื่องของ<strong> Client </strong>ที่ทำการส่งข้อมูลเข้ามาด้วย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*qP7-aT6cDEoY646BlRBuUg.png" /></figure><h3>สร้าง Realtime Server โดย Node.js</h3><p>ต่อมาเราจะทำการสร้าง <strong>Real time Server</strong> กันก่อนครับ ให้เราทำการสร้างโปรเจค <strong>Node.js</strong> ขึ้นมาก่อนครับ ใครที่ยังไม่เคยใช้งาน <strong>Node.js </strong>ให้ไปดูวิธีสร้างโปรเจคที่ ฺ<a href="https://medium.com/lffintech/api-%E0%B8%87%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B9%86%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-node-js-%E0%B8%81%E0%B8%B1%E0%B8%9A-express-84154d138e27"><strong>Blog</strong></a> นี้ได้เลยครับ</p><p>เมื่อเราทำการสร้างโปรเจคแล้วต่อมาเราจะมาทำการติดตั้ง <strong>Socket.io</strong> กันครับ โดยให้พิมพ์คำสั่งตามด้านล่างนี้เลยครับ</p><pre>npm i vue-socket.io-extended</pre><p>เมื่อติดตั้งเสร็จแล้วให้เราทำการเรียกใช้งาน Socket.io ตามตัวอย่างด่านล่างเลยครับ</p><pre>const express = require(&#39;express&#39;)<br>const app = express()<br>const http = require(&#39;http&#39;).createServer(app);<br>const io = require(&#39;socket.io&#39;)(http);</pre><pre>app.get(&#39;/&#39;, (req, res) =&gt; {<br>  res.send(&#39;Hello World&#39;)<br>});</pre><pre>io.on(&#39;connection&#39;, function(socket){<br>  console.log(&#39;a user connected&#39;);<br>  socket.on(&#39;inputMsg&#39;,async function(msg){<br>    io.emit(&#39;sendMsg&#39;,msg);<br>  });<br>  <br>  socket.on(&#39;disconnect&#39;, function(){<br>    console.log(&#39;user disconnected&#39;);<br>  });<br>});</pre><pre>http.listen(3000, function(){<br> console.log(&#39;listening on *:3000&#39;);<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8EmXamUdPoH_kQ1uoDpmg.png" /></figure><p>คำสั่ง <strong>socket.on</strong> นั้นคือการเปิดช่องรอไว้เพื่อให้ทางฝั่ง <strong>Client </strong>ทำการส่งข้อมูลเข้ามาแล้วเราก็จะใช้คำสั่ง <strong>io.emit</strong> ในการส่งข้อมูลกลับไปยังฝั่ง <strong>Client </strong>ที่ได้ทำการเชื่อมต่อและเปิดช่องรอไว้<strong> </strong>จากตัวอย่างเราได้ทำการเปิดช่องที่ชื่อว่า <strong>inputMsg</strong> รอไว้ในฝั่ง <strong>Real time server</strong> เพื่อรับข้อมูลจากฝั่งของ <strong>Client </strong>เมื่อได้รับข้อมูลแล้วก็จะทำการตอบกลับไปยัง ช่องที่ชื่อว่า<strong> sendMsg </strong>ที่ฝั่ง <strong>Client ไ</strong>ด้ทำการเปิดช่องรอไว้อยู่</p><p>ตอนนี้เราก็ได้สร้าง Realtime Server เป็นที่เรียบร้อยแล้วต่อไปเราจะทำการเรียกใช้งานในฝั่ง Client กันครับ</p><h3>เรียกใช้งาน Real tineในฝั่ง Client โดย Vue.js</h3><p>ให้เราทำการสร้างโปรเจค <strong>Vue.js</strong> ขึ้นมาเลยครับ หากใครที่ยังไม่เคยใช้งาน<strong> Vue.js</strong> ให้ทำตามบทความใน <a href="https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-vue-js-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-buefy-44a9cdceef67"><strong>Blog</strong></a><strong> </strong>นี้เลยครับ</p><p>เราจะมาทดลองทำระบบส่งข้อความแบบ <strong>Real time</strong> กันครับ ใครที่ทำการสร้างโปรเจค <strong>Vue.js </strong>เรียบร้อยแล้วให้เราทำการติดตั้ง <strong>Socket.io</strong> ได้เลยครับ</p><pre>npm i vue-socket.io-extended</pre><p>เมื่อติดตั้งเรียบร้อยแล้วให้ทำการเรียกใช้งาน <strong>Socket.io</strong> ให้เราไปที่หน้า <strong>main.js</strong> แล้วเรียกใช้งาน<strong>Socket.io</strong> และระบุ <strong>Real time server</strong> ที่เราต้องการจะเชื่อมต่อ ตอนนี้เราได้ทำการรัน <strong>Real time Server</strong> ไว้ที่เครื่องของเรา <strong>Port 3000</strong> ให้เราระบุตำแน่งของ <strong>Real time server </strong>ตามตัวอย่างด่านล่างเลยครับ</p><pre>import VueSocketio from &#39;vue-socket.io-extended&#39;;<br>import io from &#39;socket.io-client&#39;;</pre><pre>Vue.use(VueSocketio, io(&#39;http://localhost:3000/&#39;));</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAs7or6TYNzPkb9ICf6Rgw.png" /></figure><p>เมื่อทำการเรียกใช้งานแล้วให้เราทำการตรวจสอบว่า เครื่องของเรานั้นได้ทำการเชื่อมต่อไปยัง <strong>Real time Server</strong> สำเร็จหรือไม่โดยใช้คำสั่ง <strong>connect ในการตรวจสอบ</strong></p><pre>export default {<br>  name: &#39;HelloWorld&#39;,<br>  sockets: {<br>    connect() {<br>      console.log(&#39;socket connected&#39;)<br>    },<br>  },<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUYnrEkFNkiUY-WgVfy9xw.png" /></figure><p>หากเชื่อมต่อสำเร็จก็จะมีคำว่า <strong>socket connected</strong> แสดงที่ <strong>log </strong>ของหน้าที่เราทำการเรียกใช้ เมื่อเชื่อต่อ <strong>Real time Server</strong> เรียบร้อยแล้วต่อมาเราจะทำการส่งข้อมูลไปยัง <strong>Real time Server </strong>กันครับ แต่ก่อนอื่นให้เราสร้าง <strong>Template</strong>ไว้เพื่อส่งและแสดงข้อความกันก่อนครับ</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;div class=&quot;is-flex has-text-left jsCenter&quot;&gt;</pre><pre>      &lt;b-field &gt;<br>        &lt;b-input v-model=&quot;msg&quot;&gt;&lt;/b-input&gt;<br>      &lt;/b-field&gt;</pre><pre>      &lt;b-button type=&quot;is-light&quot; class=&quot;mgL5&quot;&gt;Send&lt;/b-button&gt;<br>    &lt;/div&gt;<br>  &lt;div&gt;<br>    &lt;p v-for=&quot;(item,index) in msgList&quot; :key=&quot;index&quot;&gt;<br>      {{item}}<br>    &lt;/p&gt;<br>  &lt;/div&gt;<br> &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;</pre><pre>export default {</pre><pre>  name: &#39;HelloWorld&#39;,<br>  sockets: {<br>    connect() {<br>      console.log(&#39;socket connected&#39;)<br>    },<br>  },<br>  data() {<br>    return {<br>      msg:&#39;&#39;,<br>      msgList:[]<br>    }<br>  },<br>}</pre><pre>&lt;/script&gt;</pre><pre>&lt;style scoped&gt;<br>  .jsCenter{<br>     justify-content: center;<br>  }<br>  .mgL5{<br>    margin-left: 5px;<br>  }<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6BGSgUaJ22VKzpdFbydbng.png" /></figure><p>เมื่อทำการสร้าง <strong>Template </strong>เรียบร้อยแล้วเราจะทำการสร้าง <strong>Methods </strong>ที่จะใช้ในการส่งข้อมูลและรับข้อมูลกันครับ</p><pre>mounted() {<br>  this.onMsg()<br>},<br>methods: {<br>  emitMsg(msg){<br>    this.$socket.client.emit(&#39;inputMsg&#39;,msg);<br>  },<br>  onMsg(msg){<br>    this.$socket.client.on(&#39;sendMsg&#39;,(res)=&gt;{<br>      this.msgList.push(res)<br>      this.msg = &#39;&#39;<br>    });<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-wEH1tpks2ehZsMmw55XuA.png" /></figure><p>ตอนนี้เราได้ทำการสร้าง <strong>Methods </strong>ชื่อว่า <strong>emitMsg </strong>เพื่อทำการส่งข้อมูลไปยัง <strong>Real time server</strong> และสร้าง <strong>Methods </strong>ชื่อว่า <strong>onMsg </strong>เพื่อรับข้อมูลจาก<strong> Real time server </strong>ให้เราทำการเรียกใช้ <strong>onMsg </strong>ที่ <strong>mounted </strong>เพื่อเปิดช่องที่ชื่อว่า <strong>sendMsg </strong>ไว้รอรับข้อมูลที่ <strong>Real time server</strong> ทำการส่งมา</p><p>เมื่อสร้าง <strong>Methods </strong>เรียบร้อยแล้วให้เราเปิดโปรเจค <strong>Vue.js</strong> ไว้สอง <strong>Browser </strong>หรือ เปิดโหมดไม่ระบุตัวตนขึ้นมาอีกหน้าต่างหนึ่งครับ แล้วทดลองส่งข้อความหากันระบบจะทำการส่งข้อความที่เราส่งไปให้อีก <strong>Browser </strong>หนึ่งที่ได้ทำการเชื่อมต่อและเปิดช่องรอรับข้อมูลที่ <strong>Real time server </strong>จะตอบกลับมา ทันทีที่เราได้ทำการส่งข้อความ หากสามารถทำการส่งข้อความหากันได้ตอนนี้ระบบ ส่งข้อความแบบ<strong> Real time </strong>ของเราก็เป็นอันว่าใช้งานได้ละครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnGs0uI7X1zzFTxTwYjpjQ.png" /></figure><p>ระบบ <strong>Real time</strong> ที่ผมได้นำมาสอนและทดลองทำการวันนี้นั้นก็เป็นเพียงการทดลองใช้งานในเบื้องต้น ระบบ <strong>Real time</strong> นั้นสามารถนำไปประยุกต์ใช้ประโยชน์ได้มากมายหลากหลายรูปแบบ หากใครสนใจอย่างศึกษาเพิ่มเติมก็สามารถเข้าไปศึกษาได้ที่เว็บของ<strong> </strong><a href="https://socket.io/docs/"><strong>Socket.io</strong></a> ได้เลยครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5cdad2319331" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lffintech/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%B3%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A-real-time-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-socket-io-%E0%B9%83%E0%B8%99-vue-js-node-js-5cdad2319331">การทำระบบ Real time ด้วย Socket.io ใน Vue.js + Node.js</a> was originally published in <a href="https://medium.com/lffintech">LF FINTECH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[สอนวิธีเรียกใช้งาน API ผ่าน Axios]]></title>
            <link>https://medium.com/lffintech/%E0%B8%AA%E0%B8%AD%E0%B8%99%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%81%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-api-%E0%B8%9C%E0%B9%88%E0%B8%B2%E0%B8%99-axios-7d1fb97b4107?source=rss-2d74647e97de------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d1fb97b4107</guid>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Pinyo Tadsomboon]]></dc:creator>
            <pubDate>Fri, 08 Nov 2019 19:07:43 GMT</pubDate>
            <atom:updated>2019-11-19T03:59:35.112Z</atom:updated>
            <content:encoded><![CDATA[<p>การรับข้อมูลหรือส่งข้อมูลไปยัง <strong>Server</strong> นั้นมีด้วยกันหลากหลายรูปแบบ ซึ่งการ <strong>REST API</strong> นั้นก็เป็นรูปแบบหนึ่งที่ใช่กันอย่างแพร่หลาย วันนี้เราจะมาเรียนรู้และฝึกใช้งาน <strong>Axios</strong> เพื่อทำการ <strong>REST API</strong> กันครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L0A7uw2EgYBLmb1JNTEBfA.jpeg" /></figure><p><strong>REST API</strong> หรือชื่อเต็มๆว่า <strong>Representational State Transfer</strong> นั้นคือวิธีในการสร้าง Web Service รูปแบบหนึ่งที่อาศัย <strong>HTTP Method (GET, POST, PUT, DELETE)</strong> ในการทำงาน และส่งผลกลับมาในรูปแบบของ <strong>JSON</strong> หรือ <strong>XML</strong> ทำให้สามารถรับส่งข้อมูลข้าม Platform ได้สะดวกสบายยิ่งขึ้น ทางฝั่งของ <strong>Server</strong> นั้นมีหน้าที่ในการสร้าง <strong>API</strong> ไว้เพื่อให้ทางฝั่งชอง <strong>Client</strong><em> </em>เรียกใช้งานในการรับส่งข้อมูล โดยเราจะใช้ <strong>Axios </strong>ในการจัดการกับส่วนนี้กันครับ</p><p><strong>Axios</strong> นั้นเป็น <strong>HTTP client library</strong> ตัวหนึ่งในภาษา JavaScript ที่ใช้ในการรับส่งข้อมูลและทำการติดต่อกับ <strong>Server </strong>ผ่านทาง <strong>API</strong></p><p>เมื่อได้ทำความรู้จักกับ <strong>Axios </strong>กันไปคร่าวๆแล้ว เราจะมาลองใช้งาน <strong>Axios</strong> กันครับแต่ก่อนอื่นเราต้องทำการสร้าง <strong>API</strong> ที่ฝั่งของ Server เพื่อจะได้มี API ไว้เรียกใช้งานกันกันก่อนครับ</p><p>หากใครที่ยังไม่มี <strong>Node.js</strong> ให้ทำการดาวน์โหลดแล้วติดตั้งกันก่อนนะครับ <a href="https://nodejs.org/en/"><strong>https://nodejs.org/en/download</strong></a></p><p>เมื่อโหลดเสร็จแล้วให้เราทำการสร้างโฟลเดอร์ชื่อว่า <strong>rest-api</strong> แล้วเปิด <strong>command prompt</strong> ขึ้นมาเข้าไปยังตำแหน่งของโฟลเดอร์แล้วพิมพ์คำสั่งตามด่านล่างเลยครับซึ่งจะเป็นคำสั่งในการสร้างไฟล์ <strong>package.json</strong> ขึ้นมา</p><pre>npm init -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*UiCJp9LFRgdwWTOEnYevww.png" /></figure><p>เมื่อคำสั่งทำงานเรียบร้อยแล้วสังเกตว่าจะมีไฟล์<strong> package.json </strong>เพิ่มขึ้นมา เป็นไฟล์ที่เก็บข้อมูลต่างๆของโปรเจคเรา เช่น ชื่อโปรเจค เวอร์ชั่น เป็นต้น</p><p>ตอนนี้เราได้ไฟล์ <strong>package.json</strong> แล้วเราจะทำการลง <strong>Package </strong>พื้นฐานของ <strong>Node.js</strong> และ <strong>Package </strong>ที่ชื่อว่า <strong>express </strong>ซึ่งจะทำหน้าที่ที่ช่วยจัดการเรื่องของการสร้าง<strong> API</strong> ให้เรา ต่อมาให้ทำการเปิด <strong>command prompt</strong> ขึ้นมาเข้าไปยังตำแหน่งของโปรเจค แล้วพิมพ์คำสั่งตามด้านล่างเลยครับ</p><pre>npm install express --save</pre><p>เมื่อเสร็จแล้วให้เราสร้างไฟล์ <strong>index.js</strong> จะเป็นไฟล์ที่เราใช้ในเก็บ <strong>API </strong>ของเราไว้ที่ไฟล์นี้ครับ</p><pre>const express = require(&#39;express&#39;)<br>const app = express()<br>const port = 3000</pre><pre>app.get(&#39;/&#39;, (req, res) =&gt; {<br>  res.send(&#39;Hello World&#39;)<br>})</pre><pre>app.listen(port, () =&gt; {<br>  console.log(&#39;Start server at port 3000.&#39;)<br>})</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*tClQUSNxB5UtK9AciIVtxQ.png" /></figure><p>เมื่อเสร็จแล้วลอง <strong>run </strong>ดูครับโดยใช้คำสั่ง <strong>node index</strong></p><pre>node index</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*ritHGF27YV0qycQj1gmtlA.png" /><figcaption>หาก run สำเร็จจะมีข้อความขึ้นตามภาพ</figcaption></figure><p>เสร็จแล้วให้เราไปที่ <a href="http://localhost:3000/"><strong>http://localhost:3000/</strong></a> หากได้ตามภาพด่านล่างแล้ว ต่อไปเราจะทำการสร้าง <strong>Path API</strong> ไว้ใช้งานกันครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tznTX8ioe69J3QRBGjBy0g.png" /></figure><p><strong>API </strong>ตัวแรกเราจะใช้ในการดึงข้อมูลจาก <strong>Server </strong>ครับ ในที่นี้เราจะทำการ <strong>Mockup</strong> ข้อมูลไว้ แล้วทำการ <strong>Response </strong>ข้อมูลกลับไปให้ฝั่งของ <strong>Client </strong>ให้เราทำตามโค้ดด่านล่างเลยครับ เราจะทำการรับค่าจาก<strong> Params </strong>ที่ชื่อว่า <strong>id </strong>หากค่าที่ส่งมาเท่ากับ 1 ก็จะทำการ <strong>Response </strong>ข้อมูลกลับไป</p><pre>app.get(&#39;/get/customer/:id&#39;, (req, res) =&gt; {<br>    let id = Number(req.params.id)<br>    if (id === 1) {<br>      let customer = [ <br>          {id:1,name:&#39;สมหมาย&#39;,lastName:&#39;สมดี&#39;,age:30},  <br>          {id:2,name:&#39;สมศรี&#39;,lastName:&#39;ศรีสมัย&#39;,age:25},<br>          {id:3,name:&#39;สมไทย&#39;,lastName:&#39;ใสดี&#39;,age:27},        <br>          {id:4,name:&#39;หทัย&#39;,lastName:&#39;ใจดี&#39;,age:22},<br>          {id:5,name:&#39;หัศดี&#39;,lastName:&#39;สีใส&#39;,age:23}, <br>          {id:6,name:&#39;อันนา&#39;,lastName:&#39;ดาดา&#39;,age:24},<br>          {id:7,name:&#39;ลูกตา&#39;,lastName:&#39;พาชม&#39;,age:30} <br>          {id:8,name:&#39;กังหัน&#39;,lastName:&#39;หมุ่นดี&#39;,age:27},<br>       ] <br>   res.status(200).json({ status: 200, msg: &quot;get customer success&quot;,          success: true, data: customer })<br>}else{<br>   res.status(200).json({ status: 200, msg: &quot;get customer fail&quot;, success: false, data: [] })}<br>})</pre><p><strong>API </strong>ตัวต่อมาเราจะทำการรับค่าจากฝั่ง <strong>Client</strong> เข้ามาแล้ว <strong>Response </strong>กลับไปยัง วิธีการเขียนก็คล้ายๆกับ <strong>Methods get </strong>แต่เวลารับข้อมูลของ <strong>post </strong>นั้นเราจะทำการรับค่าที่ตัว <strong>Body </strong>ดังนั้นเราต้องทำการเรียกใช้ <strong>body-parser</strong> เพื่อใช้ในการรับค่าจาก <strong>Body </strong>ก่อนครับ</p><pre>const bodyParser = require(&#39;body-parser&#39;);<br>app.use(bodyParser.json());<br>app.use(bodyParser.urlencoded({<br> extended: true<br>}));</pre><p>เมื่อเรียกใช้ <strong>body-parser </strong>แล้วให้เราสร้าง <strong>API </strong>ตามโค้ดด้านล่างเลยครับ จะเป็นการรับข้อมูลเข้ามาแล้วเช็คว่ามีการส่งข้อมูลเข้ามาไหม หากมีเราจะทำการ <strong>Response Success </strong>กลับไป แต่ถ้าไม่มีจะทำการ <strong>Response Fail</strong></p><pre>app.post(&#39;/add/customer&#39;, (req, res) =&gt; {<br>    if (Object.values(req.body).length &gt; 0) {<br>        res.status(200).json({ status: 200, msg: &quot;add customer  success&quot;, success: true})<br>    }else{<br>        res.status(200).json({ status: 200, msg: &quot;add customer fail&quot;, success: false})<br>    }<br>})</pre><p>เมื่อครบทำครบทั้งสอง API แล้วก็จะได้ตามภาพด่านล่างนี้ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VUtZ3BmCIUPl5oRrP7xH4w.png" /></figure><p>เมื่อเราสร้าง <strong>API</strong> เรียบร้อยแล้วต่อไปเราจะมาลองใช้ <strong>Axios </strong>ในการรับและส่งข้อมูลกันครับ หากใครที่ต้องการทำความเข้าใจและศึกษาเพิ่มเติมเกี่ยวกับการสร้าง API ให้เข้าไปที่ Blog นี้ได้เลยครับ <a href="https://medium.com/lffintech/api-%E0%B8%87%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B9%86%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-node-js-%E0%B8%81%E0%B8%B1%E0%B8%9A-express-84154d138e27"><strong>คลิก</strong></a></p><p>ในฝั่งของ <strong>Client </strong>นั้นผมจะใช้ <strong>Vue.js</strong> ในการเรียก <strong>Axios </strong>ให้ทุกคนสร้างโปรเจค <strong>Vue.js</strong> ขึ้นมาก่อนครับหากใครที่สร้างยังไม่เป็น ให้เข้าไปศึกษาที่ Blog นี้ได้เลยครับ <a href="https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-vue-js-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-buefy-44a9cdceef67"><strong>คลิก</strong></a></p><p>เมื่อเราสร้างโปรเจค<strong> Vue.js</strong> เรียบร้อยเราจะมาลองใช้งาน <strong>Axios </strong>กันครับ ให้เราทำการติดตั้ง <strong>Axios</strong> กันก่อนครับเปิด <strong>command prompt</strong> ไปที่โปรเจค <strong>Vue.js </strong>ของเราแล้วพิมพ์คำสั่งตามโค้ดด้านล่างเลยครับ</p><pre>npm install --save axios vue-axios</pre><p>ต่อมาให้ทำการสร้างไฟล์ชื่อว่า <strong>axios.js</strong> ไว้ที่ โปรเจค &gt; src เราจะใช้เป็นตัวกลางเพื่อเรียกใช้งาน <strong>Axios </strong>ผ่านไฟล์นี้ครับ</p><pre>import axios from &#39;axios&#39;;<br>export const HTTP = axios.create({<br>  baseURL: &#39;http://localhost:3000/&#39;,<br>});</pre><p>ในส่วนของ <strong>baseUrl </strong>ให้เราใส่ที่อยู่ของ <strong>Api </strong>ที่เราสร้างไว้ ในที่นี้คือ <a href="http://localhost:3000/"><strong>http://localhost:3000/</strong></a> ที่เราได้ทำการ Run ไว้ที่ <strong>Server</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rw5xvioR4d0JoJt9Nfir7Q.png" /></figure><p>ต่อมาให้เราไปที่ไฟล์ <strong>HelloWorld.vue</strong> แล้วสร้าง <strong>Methods </strong>ชื่อว่า <strong>getCustomer </strong>และ <strong>import axios</strong> เข้ามา เพื่อใช้ <strong>REST API</strong> จาก <strong>get/customer/:id</strong></p><pre>import {HTTP} from &quot;@/axios.js&quot;;</pre><pre>async getCustomer(){<br>  await HTTP.get(`get/customer/${1}`)<br>  .then(res =&gt; {<br>    if (res.data.success) {<br>      this.customer = res.data.data<br>    }<br>  })<br>  .catch(e =&gt; {<br>    console.log(e);<br>  });<br>}</pre><p>เสร็จแล้วเรียกใช้ <strong>getCustomer </strong>ที่ <strong>Mounted </strong>แล้วนำข้อมูลที่ได้มาเก็บไว้ในตัวแปรชื่อว่า <strong>customer </strong>แล้วทำการวนลูปที่ส่วน <strong>View </strong>ดูครับก็จะเห็นข้อมูลลูกค้าที่เรารับมาจาก <strong>Server</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*Lsvz5dj-gqFe0zkr4dXATw.png" /><figcaption>เรียกใช้งาน getCustomer ที่ Mounted</figcaption></figure><pre>&lt;template&gt;<br>  &lt;div class=&quot;container&quot;&gt;<br>    &lt;div class=&quot;columns&quot;&gt;<br>      &lt;div class=&quot;column&quot;&gt;<br>        &lt;p class=&quot;is-size-6 has-text-weight-semibold&quot;&gt;ชื่อ&lt;/p&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;column&quot;&gt;<br>        &lt;p class=&quot;is-size-6 has-text-weight-semibold&quot;&gt;นามสกุล&lt;/p<br>      &lt;/div&gt;<br>      &lt;div class=&quot;column&quot;&gt;<br>        &lt;p class=&quot;is-size-6 has-text-weight-semibold&quot;&gt;อายุ&lt;/p&gt;<br>      &lt;/div&gt;<br>  &lt;/div&gt;</pre><pre>  &lt;div v-for=&quot;item in customer&quot; :key=&quot;item.id&quot;&gt;<br>    &lt;div class=&quot;columns&quot;&gt;<br>      &lt;div class=&quot;column&quot;&gt;<br>        &lt;p class=&quot;is-size-6&quot;&gt;{{item.name}}&lt;/p&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;column&quot;&gt;<br>        &lt;p class=&quot;is-size-6&quot;&gt;{{item.lastName}}&lt;/p&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;column&quot;&gt;<br>        &lt;p class=&quot;is-size-6&quot;&gt;{{item.age}}&lt;/p&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;<br>&lt;/template&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*QxrEcZ3Vy7b3eFxBrKQ6mg.png" /><figcaption>วนลูปข้อมูลจากตัวแปร Customer</figcaption></figure><p>หากใครที่เรียกใช้งาน <strong>API </strong>แล้วติดปัญหา <strong>Blocked </strong>ให้เราไปที่ <strong>Server </strong>เปิด<strong> command prompt </strong>พิมพ์คำสั่ง <strong>npm link cors</strong> และเรียกใช้ <strong>cors </strong>เสร็จแล้วให้ทำการ <strong>Run Server</strong> แล้วทำการเรียกใช้อีกครั้งครับ</p><pre>npm link cors</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*ubfCiToUoHEqyBub34WhpA.png" /></figure><p>เมื่อรับข้อมูลจาก <strong>Server </strong>ได้แล้วเราจะมาลองส่งข้อมูลไปยัง <strong>Server </strong>กันบ้างครับให้เราทำการสร้าง <strong>Input </strong>มาสามตัวครับมี ชื่อ, นามสกุล, อายุ แล้วสร้างปุ่มไว้เรียกใช้งาน <strong>Methods </strong>ที่ชื่อว่า <strong>addCustomer</strong></p><pre>&lt;div class=&quot;columns has-text-left&quot;&gt;<br>  &lt;div class=&quot;column&quot;&gt;<br>    &lt;b-field&quot;&gt;<br>      &lt;b-input v-model=&quot;name&quot; placeholder=&quot;Name&quot;&gt;&lt;/b-input&gt;<br>    &lt;/b-field&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;column&quot;&gt;<br>    &lt;b-field&gt;<br>      &lt;b-input v-model=&quot;lastName&quot; placeholder=&quot;Last name&quot;&gt;&lt;/b-input&gt;<br>    &lt;/b-field&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;column&quot;&gt;<br>    &lt;b-field&gt;<br>      &lt;b-numberinput v-model=&quot;age&quot;  placeholder=&quot;Age&quot;&gt;&lt;/b-  numberinput&gt;<br>    &lt;/b-field&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;column is-1&quot;&gt;<br>    &lt;b-button @click=&quot;addCustomer&quot; type=&quot;is-success&quot;&gt;Add&lt;/b-button&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q0xUiDTQceO9_udKY7FDxA.png" /></figure><p>ต่อมาให้ทำการสร้าง <strong>Method addCustomer</strong> เพื่อใช้ในการส่งข้อมูลไปยัง <strong>Server </strong>เราจะทำการรับค่ามาจาก <strong>Input </strong>ทั้งสามตัวแล้วทำการส่งข้อมูลไปยัง<strong> API ที่</strong>ชื่อว่า<strong> add/customer</strong></p><pre>async addCustomer(){<br>  let obj={<br>    name:this.name,<br>    lastName:this.lastName,<br>    age:this.age<br>  }<br>  <br>  await HTTP.post(`/add/customer`,obj)<br>  .then(res =&gt; {<br>     console.log(res)<br>  })<br>  .catch(e =&gt; {<br>    console.log(e);<br>  });<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*1kSf3Ld5qexKokLwtmzwiw.png" /></figure><p>เมื่อทำการส่งค่าไปยัง <strong>Server </strong>แล้ว เราก็จะได้รับการตอบกลับมา โดยเราสามารถดูได้ผ่าน <strong>console.log()</strong> ว่า <strong>Server </strong>ได้ทำการ <strong>Response </strong>ค่ากลับมาให้เราหรือไหม หาก <strong>Response </strong>กลับมาเป็น <strong>Status 200 </strong>ก็เป็นอันว่าเรียบร้อยครับ <strong>API </strong>ของเราสามารถใช้งานได้แล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dtsgImWDGo41Ue4Wpzp5fw.png" /></figure><p>สะดวกสบายใช้ไหมละครับกับการติดต่อกับ <strong>Server </strong>เพื่อทำการรับส่งข้อมูลข้าม Platform โดยใช้การ <strong>REST API </strong>เพียงแค่เรียก <strong>Path</strong> ที่อยู่ของ <strong>API </strong>ผ่าน <strong>Axios </strong>ก็สามารถใช้งานได้แล้ว</p><p><strong>Axios </strong>นั้นยังช่วยในเรื่องการจัดการเกี่ยวกับการใช้ API ในอีกหลายส่วนเช่นเรื่องของ <strong>Authentication </strong>เป็นต้น หากใครต้องการศึกษาเพิ่มเติมสามารถเข้าไปศึกษาได้ที่ <a href="https://github.com/axios/axios"><strong>https://github.com/axios/axios</strong></a><strong> </strong>ซึ่งจะมีตัวอย่างการใช้งานให้เราได้ศึกษากันครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d1fb97b4107" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lffintech/%E0%B8%AA%E0%B8%AD%E0%B8%99%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%81%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-api-%E0%B8%9C%E0%B9%88%E0%B8%B2%E0%B8%99-axios-7d1fb97b4107">สอนวิธีเรียกใช้งาน API ผ่าน Axios</a> was originally published in <a href="https://medium.com/lffintech">LF FINTECH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[เรียนรู้การใช้งานคลาสใน Buefy]]></title>
            <link>https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B8%A5%E0%B8%B2%E0%B8%AA%E0%B9%83%E0%B8%99-buefy-6f42318f374d?source=rss-2d74647e97de------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f42318f374d</guid>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Pinyo Tadsomboon]]></dc:creator>
            <pubDate>Thu, 24 Oct 2019 20:33:32 GMT</pubDate>
            <atom:updated>2020-10-07T03:48:31.689Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*H38zPKC_Yy_d_WhG6yp8eg.png" /></figure><p>ในการใช้งาน<strong> CSS Framework </strong>นั้นนอกจากจะมี <strong>UI</strong> <strong>Components</strong> ให้เราได้ใช้งานกันแล้วนั้นก็ยังมี <strong>Class</strong> ที่สามารถใช้งานได้อีกมากมาย ซึ่งวันนี้ผมจะมาพูดถึง <strong>Class</strong> ต่างๆ ของ <strong>Buefy</strong> ที่เราน่าจะได้ใช้งานกันครับ</p><p><strong>Buefy </strong>นั้นมีทั้ง <strong>Class</strong> ที่ช่วยให้เราจัดการกับ layout และ css ที่ใช้ตกแต่ง เช่น ขนาดตัวอักษร, สีตัวอักษร, สีพื้นหลัง เป็นต้น เราจะมาเริ่มกันในส่วนของ <strong>Class </strong>ที่ใช้จัดการกับ <strong>Layout</strong> กันก่อนครับ</p><p>ในส่วนของ <strong>Layout</strong> นั้นจะเป็นเรื่องของการจัดตำแหน่งและแบ่งส่วนต่างๆ ของเว็บไซต์ในส่วนนี้เราจะมาทำความรู้จักกับ <strong>Class</strong> ที่ชื่อ <strong>columns</strong> กันครับ แต่ก่อนอื่นเรามาทำความเข้าในเรื่องของ <strong>Grid</strong> กันก่อนครับ</p><p><strong>Grid</strong> คือการแบ่ง Layout ออกเป็น 12 คอลัมน์ ในแต่ละคอลัมน์นั้นจะมาสามารถกำหนดขนาดได้แต่ขนาดทั้งหมดรวมกันในหนึ่งแถว จะต้องไม่เกิน 12 คอลัมน์ <strong>Grid </strong>นั้นจะช่วยทำให้เราสามารถจัดตำแหน่งและทำ <strong>Responsive</strong> ได้ง่ายขึ้น ต่อไปเรามาดูตัวอย่างการใช้งานกันครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoWFxcekh6cCv3LD8uBePw.png" /></figure><p>เราจะมาลองแบ่ง <strong>Grid</strong> ออกเป็น 3 ส่วนแต่ละส่วนมีขนาดเท่ากับ 4 คอลัมน์ อันดับแรกให้เราทำการเรียกใช้ <strong>Class columns</strong> ซึ่งเป็น <strong>Class</strong> ที่เราต้องสร้างมาครอบ <strong>column</strong> ทั้งหมดไว้ ต่อจากนั้นให้เราเรียกใช้ <strong>Class column</strong> พร้อมระบุ ขนาดโดยใช้ <strong>Class is-x</strong> ตัวอักษร <strong>x</strong> คือขนาดที่ต้องระบุ ตรงนี้ให้เราสร้างคอลัมน์มาทั้งหมด 3 คอลัมน์และระบุขนาดเป็น is-4 ทั้งหมด หากลองเขียนโค้ดแล้วได้ตามแบบภาพด้านล่างนี้ก็ถือว่าทำถูกต้องครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwDpgZJJ4FgXIUg1EzBLUA.png" /></figure><pre>&lt;template&gt;<br>  &lt;div class=&quot;container&quot;&gt;<br>    &lt;div class=&quot;columns&quot;&gt;<br>       &lt;div class=&quot;column is-4&quot;&gt;<br>         &lt;p class=&quot;bd-notification is-primary&quot;&gt;<br>          &lt;code&gt;is-4&lt;/code&gt;<br>         &lt;/p&gt;<br>       &lt;/div&gt;<br>       &lt;div class=&quot;column is-4&quot;&gt;<br>         &lt;p class=&quot;bd-notification is-primary&quot;&gt;<br>          &lt;code&gt;is-4&lt;/code&gt;<br>         &lt;/p&gt;<br>       &lt;/div&gt;<br>      &lt;div class=&quot;column is-4&quot;&gt;<br>        &lt;p class=&quot;bd-notification is-primary&quot;&gt;<br>          &lt;code&gt;is-4&lt;/code&gt;<br>        &lt;/p&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;HelloWorld&#39;<br>}<br>&lt;/script&gt;</pre><pre>&lt;style scoped&gt;<br> .bd-notification.is-primary {<br>   background-color: #00d1b2;<br>   color: #fff;<br> }<br> .bd-notification {<br>   background-color: #f5f5f5;<br>   border-radius: 4px;<br>   color: #7a7a7a;<br>   font-weight: 600;<br>   padding: 1.25rem 0;<br>   position: relative;<br>   text-align: center;<br> }<br> .bd-notification code, .bd-notification pre {<br>   background-color: rgba(10,10,10,.2);<br>   border-radius: 4px;<br>   color: #fff;<br> }<br>&lt;/style&gt;</pre><p>หากใครที่ต้องการศึกษาใช้งานเพิ่มเติมในส่วนนี้ก็เข้าไปศึกษาวิธีใช้ได้ที่เว็บไซต์นี้เลยครับ <a href="https://bulma.io/documentation/columns/">https://bulma.io/documentation/columns/</a></p><p>ต่อมาเราจะมาดูในส่วนของ <strong>Class</strong> ที่ใช้ในการจัดการ <strong>Css</strong> กันบ้างครับ ซึ่งในส่วนนี้ผมจะแบ่งเป็นหัวข้อในแต่ละส่วน เรามาเริ่มกันที่หัวข้อแรกกันเลยครับ</p><p><strong>การกำหนดขนาดอักษร </strong>ของ Buefy นั้นจะมีด้วยกัน 7 ระดับ โดยเริ่มตั้งแต่ 1 จะเป็นขนาดใหญ่ที่สุด ไล่ไปจนถึง 7 จะเป็นขนาดเล็กที่สุด โดยให้เราเรียกใช้ <strong>Class is-size-x </strong>ตัวอักษร <strong>x</strong> ให้เราระบุขนาดที่เราต้องการลงไปครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*31FrokUNOLjEBEwe45FRdw.png" /></figure><pre>&lt;template&gt;<br>  &lt;div class=&quot;container&quot;&gt;<br>    &lt;p class=&quot;is-size-1&quot;&gt;is-size-1&lt;/p&gt;<br>    &lt;p class=&quot;is-size-2&quot;&gt;is-size-2&lt;/p&gt;<br>    &lt;p class=&quot;is-size-3&quot;&gt;is-size-3&lt;/p&gt;<br>    &lt;p class=&quot;is-size-4&quot;&gt;is-size-4&lt;/p&gt;<br>    &lt;p class=&quot;is-size-5&quot;&gt;is-size-5&lt;/p&gt;<br>    &lt;p class=&quot;is-size-6&quot;&gt;is-size-6&lt;/p&gt;<br>    &lt;p class=&quot;is-size-7&quot;&gt;is-size-7&lt;/p&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><p><strong>ใส่ความหนาให้ตัวอักษร </strong>ความหนานั้นจะมีทั้งหมด 5 ระดับ เราจะใช้ <strong>Class has-text-weight-x</strong> ในการใส่ความหนาของตัวอักษร ให้เราลองดูตามตัวอย่างด้านล่างเลยครับในส่วนนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*2CzdX5JbwayHwd-DTbmWAg.png" /></figure><pre>&lt;template&gt;<br>  &lt;div class=&quot;container&quot;&gt;<br>    &lt;p class=&quot;is-size-1 has-text-weight-bold&quot;&gt;Bold&lt;/p&gt;<br>    &lt;p class=&quot;is-size-1 has-text-weight-semibold&quot;&gt;Semibold&lt;/p&gt;<br>    &lt;p class=&quot;is-size-1 has-text-weight-medium&quot;&gt;Medium&lt;/p&gt;<br>    &lt;p class=&quot;is-size-1 has-text-weight-normal&quot;&gt;Normal&lt;/p&gt;<br>    &lt;p class=&quot;is-size-1 has-text-weight-light&quot;&gt;Light&lt;/p&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><p><strong>จัดตำแหน่งให้กับข้อความ </strong>เราจะใช้ <strong>Class has-text-x</strong> ซึ่งจะมีอยู่ทั้งหมด 4 รูปแบบดังนี้ <strong>left </strong>คือ การจัดข้อความให้ชิดด้านซ้าย, <strong>right </strong>คือ การจัดข้อความให้ชิดด้านขวา, <strong>centered </strong>คือ<strong> </strong>การจัดข้อความให้อยู่ตรงกลาง, <strong>justified </strong>คือ<strong> </strong>การจัดข้อความให้ชิดทั้งสองด้าน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*prI0DWxzqxGhup1OwpjG2A.png" /></figure><pre>&lt;template&gt;<br>  &lt;div class=&quot;container&quot;&gt;<br>   &lt;p class=&quot;is-size-1 has-text-centered&quot;&gt;Centered&lt;/p&gt;<br>   &lt;p class=&quot;is-size-1 has-text-left&quot;&gt;Left&lt;/p&gt;<br>   &lt;p class=&quot;is-size-1 has-text-right&quot;&gt;Right&lt;/p&gt;<br>   &lt;p class=&quot;is-size-1 has-text-justified&quot;&gt;Justified&lt;/p&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><p>สุดท้ายนี้เรามาดู Class อื่นๆที่เราน่าจะได้ใช้งานกันบ้างครับ</p><pre><strong>is-marginless:</strong>ทำการลบ margin ออก<br><strong>is-paddingless:</strong>ทำการลบ padding ออก<br><strong>is-clipped:</strong>หากมีส่วนเกินออกมาจาก element ส่วนนั้นจะถูกซ้อน<br><strong>is-radiusless:</strong>ทำการลบ radius ออกจาก element<br><strong>is-shadowless:</strong>ทำการลบ shadow ออกจาก element<br><strong>is-hidden:</strong>ทำการซ้อน element<br><strong>is-relative:</strong>ใส่ position:relative ให้ element<br><strong>is-flex:</strong>ทำให้ element อยู่ในรูปแบบ flex</pre><p><strong>Class</strong> ทั้งหมดนี้ที่ผมได้นำมาสอนในวันนี้ก็เป็นเพียงส่วนหนึ่งเท่านั้นครับยังมี Class อีกมากมายที่เราสามารถเรียกใช้ได้หากใครสนใจที่จะศึกษาเพิ่มเติมก็สามารถเข้าไปศึกษาได้ที่เว็บไซต์ของ<strong> </strong><a href="https://bulma.io/documentation/"><strong>bulma</strong></a> ได้เลยครับ</p><blockquote>ปล. สำหรับคนที่ไม่รู้นะครับ Buefy นั้นเกิดจากการร่วมกันของ Bulma+Vue.js เพราะฉะนั้น Class ทุกอย่างที่ใช้กับ Buefy จะอยู่ใน Bulma ทั้งหมดครับ</blockquote><p>สามารถศึกษา <a href="https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-vue-js-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-buefy-44a9cdceef67">การเริ่มต้นใช้งาน Vue.js ด้วย Buefy</a> จากบทความของเราได้เช่นกันครับ <a href="https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-vue-js-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-buefy-44a9cdceef67"><em>ได้ที่นี่</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f42318f374d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B8%A5%E0%B8%B2%E0%B8%AA%E0%B9%83%E0%B8%99-buefy-6f42318f374d">เรียนรู้การใช้งานคลาสใน Buefy</a> was originally published in <a href="https://medium.com/lffintech">LF FINTECH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[พื้นฐานที่ควรรู้เกี่ยวกับการใช้งาน Date Time ใน Javascript]]></title>
            <link>https://medium.com/lffintech/%E0%B8%9E%E0%B8%B7%E0%B9%89%E0%B8%99%E0%B8%90%E0%B8%B2%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%84%E0%B8%A7%E0%B8%A3%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B9%80%E0%B8%81%E0%B8%B5%E0%B9%88%E0%B8%A2%E0%B8%A7%E0%B8%81%E0%B8%B1%E0%B8%9A%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-date-time-%E0%B9%83%E0%B8%99-javascript-9e39c5fd4ff1?source=rss-2d74647e97de------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e39c5fd4ff1</guid>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Pinyo Tadsomboon]]></dc:creator>
            <pubDate>Thu, 24 Oct 2019 19:45:00 GMT</pubDate>
            <atom:updated>2019-12-26T15:03:48.495Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Date Time</strong> นั้นเป็น <strong>Data type</strong> ชนิดหนึ่งที่ใช้จัดการเรื่องของวันที่และเวลา ซึ่งวันนี้เราจะมาพูดถึงพื้นฐานที่เราควรรู้เกี่ยวกับ <strong>Data type</strong> ชนิดนี้กันครับ ว่าเราจะสามารถใช้งานได้อย่างไรบ้าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*sP9Kn0cIexvTYrPLyxCNVA.jpeg" /></figure><p>ซึ่งการที่จะใช้งาน <strong>Data type</strong> ชนิดนี้ได้นั้นเราต้องทำการสร้างหรือแปลงค่าที่ได้มาให้เป็น <strong>Date Time </strong>กันก่อน โดยใช้คำสั่ง <strong>new Date() </strong>ซึ่งเราสามารถใช้ได้หลากหลายรูปแบบ ดังนั้นเราจะมาทำความรู้จักการใช้งานในแต่ละแบบกันครับ</p><p><strong>แบบที่1 </strong>การใช้คำสั่ง <strong>new Date()</strong> โดยไม่ได้กำหนดค่านั้นจะเป็นการเอาวันและเวลาปัจจุบันมาสร้างเป็น <strong>Date Time </strong>สมมุติว่าวันนี้เป็น <strong>วันที่ 21 ตุลาคม 2019 เวลา 21.46 น.</strong></p><pre>new Date() //2019-10-21T14:46:30.000Z</pre><p>ให้เราจะสังเกตว่าเวลาที่แสดงจะมากกว่าเวลาปัจจุบันไป 7 ชั่วโมงตรงนี้ไม่ต้องตกใจครับ เพราะเวลาที่ได้จะถูกแปลงเป็นเวลามาตราฐานกลางที่เรียกว่า <a href="https://th.wikipedia.org/wiki/%E0%B9%80%E0%B8%A7%E0%B8%A5%E0%B8%B2%E0%B8%AA%E0%B8%B2%E0%B8%81%E0%B8%A5%E0%B9%80%E0%B8%8A%E0%B8%B4%E0%B8%87%E0%B8%9E%E0%B8%B4%E0%B8%81%E0%B8%B1%E0%B8%94"><strong>UTC (Coordinated Universal Time)</strong></a> และ <a href="https://th.wikipedia.org/wiki/%E0%B9%80%E0%B8%A7%E0%B8%A5%E0%B8%B2%E0%B8%AA%E0%B8%B2%E0%B8%81%E0%B8%A5%E0%B9%80%E0%B8%8A%E0%B8%B4%E0%B8%87%E0%B8%9E%E0%B8%B4%E0%B8%81%E0%B8%B1%E0%B8%94"><strong>GMT (Greenwich Mean Time)</strong></a> แต่ละประเทศนั้นเวลาจะช้าเร็วไม่เท่ากันครับ จึงจำเป็นต้องมีเวลากลางและ <strong>Time Zone </strong>เป็นตัวบอกถึงระยะเวลาที่ต่างจากเวลาสากลของแต่ละประเทศ<strong> </strong>ในประเทศไทยนั้นเวลาจะเร็วกว่ามาตราฐานไป 7 ชัวโมงหากเราลองบวกเวลาที่ได้ไปอีก 7 ชัวโมงก็จะตรงกลับเวลาปัจจุบันของเราครับ</p><p><strong>แบบที่2 </strong>การกำหนดค่าให้ <strong>Date Time</strong> โดยระบุ <strong>ปี, เดือน, วัน, ชั่วโมง, นาที, วินาที, มิลลิวินาที (1,000 มิลลิวินาที หรือเสี่ยววินาที จะมีค่าเท่ากับ 1 วินาที)</strong> เช่น เราต้องการจะสร้าง <strong>Date Time</strong> เป็น <strong>วันที่ 21 ตุลาคม 2019 เวลา 21.46 น. 30 วินาที</strong></p><pre>new Date(2019<em>,9,21,21,46,30,0</em>) //2019-10-21T14:46:30.000Z</pre><p>ค่าของเดือนนั้นจะถูกนับเริ่มตั้งแต่ 0 ซึ่งจะเห็นว่าเดือนระบุลงไปคือ 9 แต่เดือนที่ได้มานั้นเป็นเดือนที่ 10 นั้นก็เพราะว่าเดือนจะถูกนับตั้งแต่ 0–11 หมายความว่าเดือนแรกสุดมกราคมจะเท่ากับ 0 ส่วนเดือนสุดท้ายธันวาคมจะเท่ากับ 11 ดังนั้น 9 จะเท่ากับเดือนตุลาคม</p><p><strong>แบบที่3 </strong>การกำหนดค่า <strong>Date Time</strong> โดยใช้ <strong>มิลลิวินาที (M<em>illiseconds</em>)</strong> ซึ่งเราจะได้ค่ามาจาก <strong>Time stamp</strong> ในส่วนนี้ผมจะพูดถึงเรื่อง <strong>Time stamp</strong> กันก่อนเพื่อให้ทุกคนได้เข้าใจถึงที่มาที่ไปกันครับ</p><p><strong>Time stamp </strong>คือ เวลาที่จะเพิ่มขึ้นทุกๆ 1 วินาที โดยเริ่มนับตั้งแต่ <strong>วันพฤหัสบดี วันที่</strong> <strong>1 มกราคม 1970</strong> <strong>เวลา 00:00:00</strong> เป็นต้นมาตามเวลาสากล ซึ่งในภาษา <strong>Javascript </strong>นั้นหน่วยของ <strong>Time stamp</strong> คือ <strong>มิลลิวินาที (M<em>illiseconds</em>) </strong>ซึ่ง 1,000 มิลลิวินาที จะมีค่าเท่ากับ 1 วินาที</p><p><strong>Time stamp</strong> นั้นสามารถนำไปใช้งานได้หลายรูปแบบ เราจะมาเรียนรู้วิธีใช้งานในเบื้องต้นกันครับ ขั้นตอนแรกเราจะทำการดึงค่า <strong>Time stamp </strong>ออกมาโดยใช้คำสั่ง <strong>Date.now()</strong> ซึ่งจะเป็นการดึงค่า <strong>Time stamp </strong>ในเวลาปัจจุบันออกมาครับ</p><pre>Date.now() //1571669190000</pre><p>แต่หากต้องการดึงค่า <strong>Time stamp </strong>จากวันเวลาที่เรากำหนดเองก็ทำได้ครับ โดยใช้คำสั่ง <strong>getTime()</strong></p><pre>new Date(2019,10,21,21,46,30,0).getTime() //1574347590000</pre><p>เมื่อเราได้ค่า <strong>Time stamp</strong> มาแล้วตอนนี้เราก็สามารถนำมาใช้งานกับคำสั่ง <strong>new Date()</strong> ได้แล้วครับ ให้เราระบุค่าลงไปก็จะได้ <strong>Date Time </strong>ของ <strong>มิลลิวินาที (M<em>illiseconds</em>) </strong>นั้นออกมาครับ</p><pre>new Date(1574347590000) //2019-11-21T14:46:30.000Z</pre><p>คราวนี้เรามาลองประยุกต์ใช้ <strong>Time stamp</strong> กันครับ ผมจะตั้งโจทย์มา 1 ข้อแล้วเรามาลองใช้ <strong>Time stamp</strong> แก้โจทย์กันครับ</p><p><strong>คำถาม: </strong>คุณได้ทำการสั่งซื้อรองเท้าจากเว็บไซต์ <strong>Alibaba </strong>ใน <strong>วันที่ 21 ตุลาคม 2019</strong> โดยสินค้าจะส่งถึงคุณภายใน <strong>วันที่ 17 พฤศจิกายน 2019</strong> คุณจะได้รับสินค้าภายในกี่วัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*B6Bo6jzXadmQVNUL7urz-w.jpeg" /></figure><p><strong>เฉลย: </strong>อันดับแรกเราต้องทำการหาค่า <strong>Time stamp</strong> ของทั้งสองวันก่อน แล้วนำค่า <strong>Time stamp</strong> ของ <strong>วันที่ 17 พฤศจิกายน</strong> <strong>2019</strong> ลบด้วยค่า <strong>Time stamp</strong> ของ <strong>วันที่ 21 ตุลาคม 2019 </strong>แล้วนำค่าที่ได้หาร <strong>86,400,000 มิลลิวินาที (M<em>illiseconds</em>) </strong>ซึ่งจะมีค่าเท่ากับจำนวน <strong>มิลลิวินาที (M<em>illiseconds</em>)</strong> ในหนึ่งวัน เมื่อหารเสร็จแล้วก็จะได้จำนวนวันที่ต้องการทราบครับ นั้นก็คือสินค้าจะส่งถึงภายในระยะเวลา 27 วัน</p><pre>let startDate= new Date(2019,9,21).getTime()<br>let endDate= new Date(2019,10,17).getTime()</pre><pre>let totaldate = (startDate - endDate)/86400000<strong><br></strong>console.log(totaldate) //27 Days</pre><p><strong>แบบที่ 4</strong> การกำหนดค่า <strong>Date Time</strong> โดยใช้ String ซึ่งรูปแบบที่ใช้ได้จะมีด้วยกัน 3 รูปแบบดังนี้ครับ ISO Date, Short Date, Long Date</p><pre>new Date(&#39;2019-10-21&#39;) //ISO Date<br>new Date(&#39;10/21/2019&#39;) //Short Date<br>new Date(&#39;Oct 21 2019&#39;) or new Date(&#39;21 Oct 2019&#39;) //Long Date</pre><p>ในส่วนที่ผมได้นำมาอธิบายในวันนี้ ก็เป็นพื้นฐานเล็กๆน้อยที่เราควรรู้ไว้เกี่ยวกับการใช้งาน <strong>Date Time</strong> นอกจากนี้แล้วก็ยังมี <strong>Function </strong>อีกมากมายที่เราสามารถนำมาประยุกต์ใช้ได้ซึ่งหากใครสนใจที่อยากจะศึกษาเพิ่มเติมสามารเข้าไปศึกษาได้ที่ <a href="https://www.w3schools.com/js/js_dates.asp"><strong>https://www.w3schools.com</strong></a> เลยครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e39c5fd4ff1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lffintech/%E0%B8%9E%E0%B8%B7%E0%B9%89%E0%B8%99%E0%B8%90%E0%B8%B2%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%84%E0%B8%A7%E0%B8%A3%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B9%80%E0%B8%81%E0%B8%B5%E0%B9%88%E0%B8%A2%E0%B8%A7%E0%B8%81%E0%B8%B1%E0%B8%9A%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-date-time-%E0%B9%83%E0%B8%99-javascript-9e39c5fd4ff1">พื้นฐานที่ควรรู้เกี่ยวกับการใช้งาน Date Time ใน Javascript</a> was originally published in <a href="https://medium.com/lffintech">LF FINTECH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[เริ่มต้นใช้งาน Vue.js ด้วย Buefy]]></title>
            <link>https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-vue-js-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-buefy-44a9cdceef67?source=rss-2d74647e97de------2</link>
            <guid isPermaLink="false">https://medium.com/p/44a9cdceef67</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Pinyo Tadsomboon]]></dc:creator>
            <pubDate>Sat, 12 Oct 2019 10:30:20 GMT</pubDate>
            <atom:updated>2020-10-07T03:40:36.629Z</atom:updated>
            <content:encoded><![CDATA[<p>สวัสดีครับวันนี้ผมจะมาสอนวิธีติดตั้ง <a href="https://vuejs.org/">Vue.js</a> และ <a href="https://buefy.org/">Buefy</a> แต่ก่อนที่เราจะเริ่มติดตั้งกันเราจะมาทำความรู้จักกับสองตัวนี้กันก่อนครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*xO1hVsoV6JDCuPZWNXrOPg.png" /></figure><p><strong>Vue.js</strong> คือ Framework ที่ใช้จัดการในส่วนติดต่อผู้ใช้ (UI) ซึ่งเป็นการผสมผสานระหว่าง <strong>AngularJs </strong>กับ <strong>React</strong> เพื่อสร้าง <strong>Reactive Component</strong> คือคอมโพแนนท์ที่สามารถอัพเดทตัวเองได้ <strong>Reactive</strong> นั้นคือการโต้ตอบแบบทันที หากค่าในตัวแปรใดตัวแปรหนึ่งใน DOM มีการเปลี่ยนแปลงตัวแปรนั้นก็จะสามารถเปลี่ยนแปลงได้ทันที</p><p>ส่วน <strong>Buefy</strong> นั้นคือ <strong>CSS Framework</strong> ที่เกิดจากการรวมกันของ <a href="https://vuejs.org/">Vue.js </a>กับ <a href="https://bulma.io/">Bulma</a> ซึ่งทำหน้าที่จัดการรูปแบบโครงสร้างหน้าตาของเว็บไซต์</p><p>เมื่อทำความรู้จักกับ <a href="https://vuejs.org/">Vue.js</a> และ <a href="https://buefy.org/">Buefy</a> กันแล้ว ต่อมาเราจะมาเริ่มติดตั้ง Vue-cli ซึ่งเราจะใช้ในการติดตั้งโปรเจคของเราครับ</p><p>อันดับแรกหากใครที่ยังไม่มี <strong>Node.js</strong> ให้ทำการดาวน์โหลดแล้วติดตั้งได้เลยครับ <a href="https://nodejs.org/en/"><strong>https://nodejs.org/en/download</strong></a></p><p>เมื่อติดตั้ง <a href="https://nodejs.org/en/download/">Node.js</a> เรียบร้อยแล้วให้ทำตามขั้นตอนด้านล่างต่อได้เลยครับ</p><p><strong>ขั้นตอนที่ 1 </strong>ให้ทำการติดตั้ง <a href="https://cli.vuejs.org/guide/installation.html"><strong>Vue-cli</strong></a> โดยเปิด <strong>command prompt</strong> ขึ้นมาแล้วพิมพ์คำสั่งตามด้านล่างเลยครับ</p><pre>npm install -g @vue/cli</pre><p>หากใครที่ไม่รู้วิธีใช้ command prompt ให้เข้าไปศึกษาที่ลิ้งนี้ได้เลยครับ <a href="https://medium.com/arcadia-software-development/%E0%B8%84%E0%B8%B3%E0%B8%AA%E0%B8%B1%E0%B9%88%E0%B8%87-command-line-%E0%B8%9E%E0%B8%B7%E0%B9%89%E0%B8%99%E0%B8%90%E0%B8%B2%E0%B8%99-%E0%B9%81%E0%B8%A5%E0%B8%B0%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%84%E0%B8%B3%E0%B8%AA%E0%B8%B1%E0%B9%88%E0%B8%87%E0%B8%95%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B9%86-871f18f90c82">คลิก</a> เครดิตจาก Blog ของ <a href="https://medium.com/@rukpong?source=post_page-----871f18f90c82----------------------"><strong>Mr.Rukpong</strong></a></p><p><strong>ขั้นตอนที่ 2 </strong>เมื่อติดตั้ง <strong>Vue-cli</strong> เสร็จแล้วเราจะทำการสร้างโปรเจคของเรากันครับ ให้เข้าไปที่ Directory ที่ต้องการเก็บโปรเจคของเราไว้ เมื่อได้ Directory ที่ต้องการแล้วให้พิมพ์คำสั่งตามด้านล่างได้เลยครับ</p><pre>vue create vue-buefy</pre><p><strong>vue create </strong>คือคำสั่งที่ใช้สร้างโปรเจค ส่วนด้านหลังคือชื่อของโปรเจคเราครับ ในที่นี้ผมจะใช้ชื่อว่า <strong>vue-buefy</strong></p><p>ระบบก็จะถามเราว่าจะตั้งค่าโปรเจคเป็นแบบไหน ตรงนี้ให้เราเลือกเป็น default ได้เลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*ZoJy0IjrAmoeMBBYBRLrZw.png" /></figure><p>ต่อมาก็จะให้เราเลือกว่าจะใช้ Package manager ตัวไหน ตรงนี้ให้เราเลือกเป็น NPM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*GThEndLY4Fl7GzRcyTxbkw.png" /></figure><p><strong>Vue-cli</strong> ก็จะทำการสร้างโปรเจคให้เรา เมื่อสร้างเสร็จแล้วก็จะได้โครงสร้างไฟล์ตามภาพด้านล่างนี้ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*Ou9FFXHbQBXfJZ9JlkZ0fQ.png" /><figcaption>โครงสรา้งโปรเจคที่ vue-cli สร้างให้</figcaption></figure><p>ต่อมาเราจะมาลองรันโปรเจคดูกันครับให้ไปที่ Directory ของโปรเจคเรา โดยพิมพ์คำสั่ง cd แล้วตามด้วยชื่อโปรเจคของเรา คำสั่งนี้จะเป็นการเข้าถึงไฟล์โปรเจคที่เราสร้างไว้ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*a2mcAIRiP2ee7SQ_4mt1FA.png" /></figure><pre>cd vue-buefy</pre><p>เมื่อเข้ามาในโปรเจคแล้วให้เราทำการรันโดยพิมพ์คำสั่งตามด้านล่างเลยครับ</p><pre>npm run serve</pre><p>พอรันเสร็จแล้วให้เราเข้าไปที่ <a href="http://localhost:8080/">http://localhost:8080</a> ถ้ารันสำเร็จก็จะเป็นเหมือนภาพด้านล่างเลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*LB4jO0MAKVUCQDUkRShm3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTFGhwsgY_KPkY_uPBJMtA.png" /></figure><p>ตอนนี้เราก็ได้สร้างโปรเจค <strong>Vue.js</strong> ของเราเป็นที่เรียบร้อยแล้ว ขั้นต่อไปเราจะทำการติดตั้ง <strong>Buefy</strong> ลงในโปรเจคของเรากันครับ</p><p><strong>ขั้นตอนที่ 3 </strong>ให้เราทำการติดตั้ง <strong>Buefy</strong> โดยพิมพ์คำสั่งตามด้านล่างนี้ใน command prompt แล้วกด Enter</p><pre>npm install buefy</pre><p>เมื่อติดตั้งเสร็จแล้วให้เราทำการเรียกใช้ <a href="https://buefy.org/">Buefy</a> ใน <a href="https://vuejs.org/">Vue.js</a><strong> </strong>โดยไปที่ <strong>./src/main.js</strong> แล้ว คัดลอกโค้ดด้านล่างไปใส่ที่ไฟล์ <strong>main.js</strong></p><pre>import Buefy from ‘buefy’ <br>import ‘buefy/dist/buefy.css’</pre><pre>Vue.use(Buefy)</pre><blockquote><strong>อธิบายโค้ด:</strong> คำสั่ง import Buefy from ‘buefy’ และ import ‘buefy/dist/buefy.css’ คือการ import Buefy เข้ามา แล้วใช้คำสั่ง Vue.use(Buefy) ในการเรียกใช้ Buefy</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*f586MUAhR_ssYQDReK-zOg.png" /><figcaption>เราก็จะได้โค้ดหน้าตาแบบนี้ในหน้า main.js</figcaption></figure><p>ต่อมาเราจะทำการ import icon เพื่อให้ <strong>Buefy</strong> สามารถใช้งาน icon ได้ให้เราไปที่ <strong>./public/index.html </strong>แล้วทำการ คัดลอกโค้ดด้างล่างไปใส่ที่ไฟล์ <strong>index.html </strong>ส่วนแรกจะเป็นการ import icon ของ <a href="https://materialdesignicons.com/"><strong>Material Design Icons</strong></a> และส่วนที่สองจะเป็น icon ของ <a href="https://fontawesome.com/"><strong>Font Awesome</strong></a></p><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.materialdesignicons.com/2.5.94/css/materialdesignicons.min.css&quot;&gt;</pre><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://use.fontawesome.com/releases/v5.2.0/css/all.css&quot;&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*CGTKN9xB09vyKPH_9QfIGQ.png" /><figcaption>เราก็จะได้โค้ดหน้าตาแบบนี้ในหน้า index.html</figcaption></figure><p>เมื่อเราได้ทำการติดตั้ง <strong>Buefy </strong>เป็นที่เรียบร้อยแล้ว ต่อมาเราก็จะมาทำการทดสอบใช้งานกันครับ ให้เราคัดลอกโค้ดด่านล่างนี้ไปใส่ในไฟล์ <strong>HelloWorld.vue</strong> โดยเข้าไปที่ <strong>./src/component/HelloWorld.vue</strong></p><pre>&lt;section class=&quot;container has-text-left&quot;&gt;</pre><pre>&lt;b-field label=&quot;Name&quot;&gt;</pre><pre>   &lt;b-input value=&quot;Kevin Garvey&quot;&gt;&lt;/b-input&gt;</pre><pre> &lt;/b-field&gt;</pre><pre> &lt;b-field label=&quot;Email&quot;</pre><pre>   type=&quot;is-danger&quot;</pre><pre>   message=&quot;This email is invalid&quot;&gt;</pre><pre>   &lt;b-input type=&quot;email&quot;</pre><pre>     value=&quot;john@&quot;</pre><pre>     maxlength=&quot;30&quot;&gt;</pre><pre>   &lt;/b-input&gt;</pre><pre> &lt;/b-field&gt;</pre><pre> &lt;b-field label=&quot;Username&quot;</pre><pre>   type=&quot;is-success&quot;</pre><pre>   message=&quot;This username is available&quot;&gt;</pre><pre>   &lt;b-input value=&quot;johnsilver&quot; maxlength=&quot;30&quot;&gt;&lt;/b-input&gt;</pre><pre> &lt;/b-field&gt;</pre><pre>&lt;/section&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*YjJtolK5mH1C0RLCk0tasw.png" /></figure><p>เมื่อเสร็จแล้วให้เราลองรันดูครับหากได้หน้าตาเหมือนภาพด้านล่างนี้ก็เป็นอันว่าเรียบร้อยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVep5DAclU0vl9FhLYsI1w.png" /></figure><blockquote>หากใครที่ต้องการศึกษาเพิ่มเติมก็สามารถเข้าไปที่เว็บของตามลิ้งที่ให้ไว้ได้เลยครับ <strong>Vue.js(</strong><a href="https://vuejs.org/v2/guide/"><strong>https://vuejs.org/v2/guide</strong></a><strong>) Buefy(</strong><a href="https://buefy.org/documentation"><strong>https://buefy.org/documentation</strong></a><strong>)<br>หรือ </strong>เรียนรู้การใช้งานคลาสใน Buefy จากบทความของเรา <a href="https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B8%A5%E0%B8%B2%E0%B8%AA%E0%B9%83%E0%B8%99-buefy-6f42318f374d">ได้ที่นี่ </a>เช่นกันครับ</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44a9cdceef67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lffintech/%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-vue-js-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-buefy-44a9cdceef67">เริ่มต้นใช้งาน Vue.js ด้วย Buefy</a> was originally published in <a href="https://medium.com/lffintech">LF FINTECH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ประสบการณ์ที่มากกว่าการเป็น Programmer]]></title>
            <link>https://medium.com/lffintech/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%AA%E0%B8%9A%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%93%E0%B9%8C%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%A1%E0%B8%B2%E0%B8%81%E0%B8%81%E0%B8%A7%E0%B9%88%E0%B8%B2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99-programmer-b85951e52717?source=rss-2d74647e97de------2</link>
            <guid isPermaLink="false">https://medium.com/p/b85951e52717</guid>
            <category><![CDATA[team]]></category>
            <dc:creator><![CDATA[Pinyo Tadsomboon]]></dc:creator>
            <pubDate>Sat, 27 Jul 2019 09:46:47 GMT</pubDate>
            <atom:updated>2019-07-27T16:24:20.091Z</atom:updated>
            <content:encoded><![CDATA[<p>สวัดดีครับ ผมชื่อ “แชมป์” เป็น Front End Developer ของบริษัท <strong>LFFINTECH Co.,Ltd.</strong> ผมอยากจะมาแชร ์และบอกเล่าประสบการณ์การทำงานให้ทุกท่านได้ฟังกันครับ</p><h3><strong>ทุกคนมีเป้าหมายของตัวเอง</strong></h3><p>การทำงานที่ <strong>LFFINTECH Co.,Ltd.</strong> นั้นทุกคนจะได้ตั้งเป้าหมายของตัวเอง แนวทางหรือสิ่งที่อยากจะเป็นในอนาคต ทุกคนสามารถเลือกได้ว่าอยากจะพัฒนาตนเองไปในแนวทางไหน โดยที่จะมีพวกพี่ๆ ค่อยให้คำปรึกษาว่าเรายังขาดอะไร หรือ ต้องพัฒนาตนเองในด้านไหนบ้างที่จะทำให้เราไปให้ถึงเป้าหมายที่ตั้งไว้</p><p>ในการทำงานนั้นที่นี้รับฟังทุกปัญหาและความคิดเห็นครับ หากงานทีทำอยู่นั้นรู้สึกว่าไม่ Make sense นั้นทุกคนมีสิทธิ์ที่จะบอก และเสนอแนวทางการแก้ไขแล้วพวกพี่ๆ ก็จะนำไปพิจารณาร่วมกับเราว่าสิ่งที่เราเสนอไปมีข้อดีข้อเสียยังไง และปัญหาที่เราเจอมันไม่ Make sense ยังไง เพื่อที่จะหาข้อสรุปที่ดี และถูกต้อง</p><h3>การติดตามงานรูปแบบใหม่</h3><p>ก่อนที่ผมจะมาทำงาน <strong>LFFINTECH Co.,Ltd.</strong> ผมก็เจอรูปแบบการติดตามงานมาหลายรูปแบบ ไม่ว่าจะเป็นการให้ลงบันทึกสิ่งที่ทำในโปรแกรมว่าเราทำอะไรไปบ้างในวันนี้ หรือการเดินมาถามกันตัวต่อตัวว่าวันนี้ทำอะไรบ้าง ซึ่งในตอนแรกที่นี้ก็ใช้วิธีการติดตามงานในรูปแบบนี้แหละครับ แต่พอหลังจากผมทำงานได้ไม่นาน ก็มีการติดตามงานในรูปแบบใหม่ที่เรียกว่า <strong>Standup meeting</strong></p><p><strong>Standup meeting </strong>นั้นคือการที่เราทุกคนจะมายื่นล้อมวงคุยกัน ถึงสิ่งที่ได้ทำไปแล้ว รวมไปถึงปัญหาที่เจอในระหว่างทำงาน และสิ่งที่กำลังจะทำต่อจากนี้ สำหรับผมแล้ว <strong>Standup meeting </strong>เป็นสิ่งที่แปลกใหม่ และผมก็ชอบวิธีการติดตามงานในรูปแบบนี้มาก เพราะทุกคนได้มายืนคุยกัน ได้รู้ว่าใครกำลังทำอะไรอยู่ และติดปัญหาอะไร จึงทำให้ทุกคนเข้าถึงกันได้ง่ายยิ่งขึ้น เมื่อเวลาเจอปัญหาทุกคนก็รับรู้ได้ว่าคนๆนั้นเขาติดปัญหาอะไร คนที่รู้วิธีแก้ไขก็จะสามารถเข้าไปช่วยเหลือได้ แถมยังช่วยให้รู้ความคืบหน้าของงานแต่ละคนด้วย และการที่เรายืนล้อมวงคุยกันนั้นมันก็ทำให้บรรยากาศดูไม่ตรึงเครียดจนเกินไป เเละยังเป็นการฝึกทักษะการพูดไปในตัวด้วย</p><h3>สิ่งที่ไม่คิดว่าจะได้ทำ</h3><p>ใครจะไปคิดว่านั่งเขียนโปรแกรมอยู่ดีๆ ก็ได้ไปลองทำในสิ่งที่เราไม่เคยทำด้วยอย่างการได้ไปบรรยาย และแชร์ความรู้เรื่องเทคโนโลยีใหม่ๆให้กับน้องๆที่มหาวิทยาลัยแม่ฟ้าหลวง งานนั้นเป็นการจัดอบรมเกี่ยวกับเรื่องการทำธุรกิจ <strong>Startup </strong>ให้น้องๆมหาวิทยาลัยแม่ฟ้าหลวงครับพวกพี่ๆก็ไปบรรยายด้วยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*HmgaTNlT2U3y8c7obY5lxA.jpeg" /></figure><p>ตอนนั้นตื่นเต้นมากๆ เลยครับสมัยที่ผมเรียนแค่ไปพรีเซนต์หน้าห้องผมก็มือสั้นไปหมดแล้วครับ แต่นี่ต้องมาบรรยายต่อหน้าน้องๆ หลายร้อยคนจะรอดไหมเนี้ย 555+ ยิ่งผมเป็นคนที่เวลาตื่นเต้นมือจะสั่นมากผมเลยขอพี่ๆ ว่าขอนั่งบรรยายได้ไหม พี่เขาก็อนุญาติครับ พอเริ่มพูดตอนแรกก็ตื่นเต้น แต่พอพูดไปสักพักมันก็เริ่มหายไม่ตื่นเต้นและก็ผ่านไปด้วยดีครับ นอกจากการไปบรรยายแล้วผมก็ยังได้ความรู้ใหม่ๆ ไม่ว่าจะเป็นเรื่องของการทำธุรกิจ <strong>Startup </strong>การวางแผน <strong>model</strong> ธุรกิจ ได้เห็นน้องที่มีไอเดียดีๆ และไอเดียแปลกๆก็มีครับ ผมได้ประสบการณ์ในหลายเรื่องมากครับ ถือว่าคุ้มค่ามากครับที่ได้ไปบรรยายในครั้งนั้น</p><p>นอกจากการเขียนโปรแกรมแล้วนั้น เราก็ต้องเข้าใจผู้ใช้ด้วยว่าเขามีปัญหาอะไร หรือความต้องการอะไรในการใช้งานระบบของเรา มีช่วงหนึ่งครับที่เราทุกคนได้ไปสอนใช้งานระบบให้กับผู้ใช้ พวกเราก็แบ่งทีมกันไปครับไปกันทั่วประเทศเลยครับหลายที่มาก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*XNmgubf5Wr04WOveqJe5Bg.jpeg" /></figure><p>การที่ได้ออกไปสอนการใช้งานในครั้งนั้นทำให้ได้เข้าใจมุมมองของผู้ใช้งานอย่างแท้จริงครับว่าสิ่งที่เขาต้องการคือไรและเขามีปัญหาอะไร ทำให้เราได้เข้าถึงและแก้ปัญหาได้ถูกจุด</p><p>และนี้ก็เป็นประสบการณ์ของผมที่ได้ทำงานที่ <strong>LFFINTECH Co.,Ltd. </strong>ครับ ที่นี้ยังมีประสบการณ์อีกมากมายที่เราจะได้เรียนรู้ สิ่งที่ผมเอามาแชร์ ก็เป็นแค่ส่วนหนึ่งครับ</p><p>หากใครที่ชอบการเรียนรู้และได้ลองทำสิ่งใหม่ๆ ก็ลองเข้ามาเป็นส่วนหนึ่งของ <strong>LFFINTECH Co.,Ltd. </strong>ได้นะครับมาเรียนรู้สิ่งใหม่ๆ ไปด้วยกันครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b85951e52717" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lffintech/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%AA%E0%B8%9A%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%93%E0%B9%8C%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%A1%E0%B8%B2%E0%B8%81%E0%B8%81%E0%B8%A7%E0%B9%88%E0%B8%B2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99-programmer-b85951e52717">ประสบการณ์ที่มากกว่าการเป็น Programmer</a> was originally published in <a href="https://medium.com/lffintech">LF FINTECH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>