在 Nuxt 3.13 使用 Google Fonts 字體和圖示

做法

安裝 Nuxt Google Fonts 模組。

1
npx nuxi@latest module add google-fonts

修改 nuxt.config.ts 檔。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export default defineNuxtConfig({
modules: [
'@nuxtjs/google-fonts',
],
googleFonts: {
display: 'swap',
families: {
'Roboto': {
wght: [400, 500, 700],
},
'Noto Sans TC': {
wght: [400, 500, 700],
},
'Noto Sans JP': {
wght: [400, 500, 700],
},
},
},
});

參考資料

Nuxt Scripts