2022年8月26日 星期五

vue 使用中文注意事項

v-for 走訪物件名稱不要用中文,否則會造成事件函數永遠抓到第一個物件,舉例:
<div v-for="訂單 in 訂單s" :key="訂單.訂單編號">
<i class="bi bi-chevron-double-down" style="position:absolute;bottom:0.25em;right:0.25em;" @click="訂單.展開=true" ></i> // "訂單"抓到的是第一個物件而非當下走訪的物件
</div>

產生二維條碼

後端

安裝nuget套件 ZXing.Net

BarcodeWriter bw = new BarcodeWriter();
bw.Format = BarcodeFormat.QR_CODE;
bw.Options.Hints.Add(EncodeHintType.MARGIN, 2); // 避免內距太寬造成圖片過小
bw.Options.Height = bw.Options.Width = 80;
Bitmap bitmap = bw.Write("123");
var picture = sheet.Drawings.AddPicture("123", bitmap);
picture.SetPosition(0, 0, 0, 0); // zero base

前端

2022年8月21日 星期日

ass 雙語字幕隱藏英文

通常第二字幕為英文,且位置在下黑框處,透過修改顏色為黑色以便隱藏英文,例如:
Dialogue: 0,0:21:13.41,0:21:15.77,Default,,0,0,0,,格温\N{\fn微软雅黑\fs14}Gwen.
調整如下
Dialogue: 0,0:21:13.41,0:21:15.77,Default,,0,0,0,,格温\N{\fn微软雅黑\fs14\c&H000000}Gwen.

Entity Framework 建立新物件並儲存後馬上取得關聯資料

使用 CreateProxy 建立物件,不要直接 new var newmodel = _contextXXX.CreateProxy<yyy>(); ... _contextXXX.yyy.Add(newmodel); await _contextXXX.SaveC...