從零開始建造一個vue項目

準備工作 環境依賴:Node.js; vue官方腳手架:  vue-cli; 具體怎麼安裝nodejs和vue-cli的部分就不再具體說明了,請查看官方文檔按步驟執行即可(安裝nodejs會安裝npm(包管理工具),vue-cli依賴npm來安裝,注意這個先後關係)。 背景知識 vue.js核心  框架 webpack  打包工具,使用vue-cli初始化項目的時候,我們選擇webpack作為我們的模塊打包工具 開始動手 初始化項目,選擇webpack作為打包工具,項目名稱是my-project,然後按照提示進行一些配置,過程中可以選擇使用vue-router(推薦使用);這些配置最終會寫到項目的package.json中和安裝相應的模塊 vue init webpack my-project 复制代码 接下來使用自己熟悉的編輯器打開項目,目錄結構大致是這樣的 構建和配置目錄:webpack打包的相關配置文件 src目錄:我們最終編寫業務代碼的地方 static目錄:我也不知道幹嘛用的 package.json package.json是項目最基礎的配置文件。可以發現裡面的很多內容,例如名稱,作者,描述等就是剛才初始化項目時我們填充的值; dependencies和devDependencies是項目依賴的包,運行項目之前需要先執行npm install來安裝項目所依賴的包 npm install复制代码 然後我們來重點關註一下scripts npm允許在package.json文件裡面,使用scripts分區定義腳本命令。其中dev和start都是啟動本地開發環境的,lint是做語法校正的,build是打包最終在線代碼的 { “name”: “my-project”, “version”: “1.0.0”, “description”: “A Vue.js project”, “author”: “ideagay <[email protected]>”, “private”: true, “scripts”: { “dev”: “webpack-dev-server –inline –progress –config build/webpack.dev.conf.js”, “start”: “npm run dev”, […]

How to Use MQTT With the Raspberry Pi and ESP8266

In this Instructable, I will explain what the MQTT protocol is and how it is used to communicate between devices.Then, as a practical demonstration, I shall show you how to setup a simple two client system, where an ESP8266 module will send a message to a Python program when a button is pushed. Specifically, I […]

IoT based Smart Irrigation System using Soil Moisture Sensor and ESP8266 NodeMCU

IoT based Smart Irrigation System using Soil Moisture Sensor and ESP8266 NodeMCU Most of the farmers use large portions of farming land and it becomes very difficult to reach and track each corner of large lands. Sometime there is a possibility of uneven water sprinkles. This result in the bad quality crops which further leads […]

ADS1115 analog-to-digital converter and ESP8266

The ADS1115 device is a precision, low-power, 16-bit, I2C-compatible, analog-to-digital converters (ADCs) offered in an ultra-small, leadless, X2QFN-10 package, and a VSSOP-10 package. The ADS1115 device incorporates a low-drift voltage reference and an oscillator. The ADS1115 also incorporate a programmable gain amplifier and a digital comparator. These features, along with a wide operating supply range, […]