博客 / 列表

明未為洺 - scss 遍歷數組

each遍歷 $colors: ( #00D477, #F57933, #0052F5 ); @each $c in $colors { $i: index($colors, $c); .tag-#{$i} { background-color: $c; } } 生成的結果如下: .tag-1 { ba

sass , scss

明未為洺 - TS泛型粗淺理解 一

在使用react-router-dom的時候,用到了useMatches的方法,ts一直提示報錯,如下: 根據提示,找到了這個類型: export interface UIMatchData = unknown, Handle = unknown { id: string; pathname: string; params: AgnosticRouteMatch["

react , 泛型 , typescript

明未為洺 - 無頭瀏覽器初體驗-事件點擊

以下功能基於puppeteer實現 中文文檔 英文文檔 引入插件,並且打開啓動 const puppeteer = require('puppeteer'); (async () = { browser = await puppeteer.launch({ headless: true, // defaultViewport: { width

puppeteer , node.js , 爬蟲

明未為洺 - 文件url路徑轉換file對象

實現一個小功能,遠程url轉為file對象 方案一: function getFileFromUrl(url: string, fileName: string) { return new Promise(async (resolve, reject) = { const response = await fetch(url); const blob = await re

file , blob , Javascript

明未為洺 - vue導出pdf

vue中實現頁面導出pdf的功能 所需插件 html2canvas和pdfmake 原理就是將頁面截圖,然後生成pdf文件,具體代碼如下 const main = ref() async function exportPdf() { const canvas = await html2canvas(main.value, { allowTaint: true, scal

vue.js , pdfmake , html2canvas , vue3

明未為洺 - scss基礎語法的簡單使用

1. 變量聲明及使用 $color: red; .box { color: $color; } 2. mixin和include 2.1 簡單使用 $bgColor: red; @mixin bg { background: $bgColor; } .box { @include bg; } 編譯結果: .box { background: red; } 2.2 進

sass , scss , map , Css , for循環