react - next.js 引用本地图片和css文件

1. 图片

把图片放在/static/文件夹中,在component中用img tag:

<img src={'../static/icon.png'} />

 

2. css

把css文件放在/static/文件夹中,在pages/index.js中添加Head和link:

import Head from 'next/head'
class HomePage extends React.Component { render() { return (

       

     )
   }
}

 

转载于:https://www.cnblogs.com/argenbarbie/p/9007992.html

你可能感兴趣的:(javascript)