current position:Home>Use font icons in nuxt to solve the problem that the icon can be loaded for the first time and the icon disappears after refreshing the page

Use font icons in nuxt to solve the problem that the icon can be loaded for the first time and the icon disappears after refreshing the page

2022-08-06 09:32:03Fan Xiaoduo

insert image description here
Troubleshoot relative paths

Add the following to nuxt.config.js

export default {...css: ['@/assets/font/iconfont.css'],plugins: [{src: '@/assets/font/iconfont.js',ssr: false,},],...}

Use

<i class="iconfont icon-xxx">i>

copyright notice
author[Fan Xiaoduo],Please bring the original link to reprint, thank you.
https://en.chowdera.com/2022/218/202208060926329136.html

Random recommended