Feb. 2024
2 nd
元件庫
- Vue DevUI
基於 Vue3 的 UI 元件庫。
問題
v-for
不要用index
作為key
push
沒有影響,但是unshift
有
因為用unshift
會造成前面幾項的index
不同,所以全部子節點都會更新- 就算是
id-${i}
之類的也一樣,只要有index
都會影響
5 th
Nginx
Location
nginxhttp { server { listen 80; server_name www.example.com; location / { root /home/www/ts/; index index.html; } } }
訪問 www.example.com 的 80 port 時,會回傳
/home/www/ts/index.html
文件。=
:精準匹配nginxlocation = /test { return 200 "hello"; } # /test ✅ # /test/ ❌ # /test2 ❌ # /test/2 ❌
~
:區分大小寫的正則匹配nginxlocation ~ ^/test$ { return 200 "hello"; } # /test ✅ # /Test ❌ # /test/ ❌ # /test2 ❌
~*
:不區分大小寫的正則匹配nginxlocation ~* ^/test$ { return 200 "hello"; } # /test ✅ # /Test ✅ # /test/ ❌ # /test2 ❌
^~
:以某個字符開頭nginxlocation ^~ /images/ { return 200 "hello"; } # /images/1.gif ✅
/
:通用匹配nginxlocation / { return 200 "hello"; } # /index.html ✅
nginxlocation /test { return 200 "hello"; } # /test ✅ # /test2 ✅ # /test/ ✅
INFO
- 順序:前綴字串順序不重要,依照符合長度來決定,正規表示式則是依照定義順序。
- 優先度:
=
最高,^~
次之,再者是正則,最後是前綴字串匹配。
root
主要是拼接成
root
+location
nginxlocation /i/ { root /data/w3 }
請求
/i/top.gif
,會回傳/data/w3/i/top.gif
。alias
主要是把
location
替換成alias
nginxlocation /i/ { alias /data/w3/images/; }
請求
/i/top.gif
,會回傳/data/w3/images/top.gif
。