Talking about script, link, import, @import introduction

1. Page import style, what is the difference between using link and @import

What is the difference between link type and import type (link type, import type, embedded type, inline) 1. Affiliation: link is an
html tag, @import is provided by css.
2. Loading difference: when the page is loaded, link will be loaded at the same time; @import will be loaded after the html structure is completed. style, whereas @import cannot

2. Scenarios of script, link, import, @import

1. script, link are html tags, script can import js, you can call the method of importing js, link tag can import css style pictures, <link rel="icon" href="/favicon.ico" />etc.
2. import is tp syntax, you can import js or css. When import introduces the js method, the method can be exported
as follows:

Export objects by default

export default 对象
import 对象 from '此对象目录地址';

Export the file, parse the file object

i.
export function(){
    
    }
import {
    
    对象} from '此对象目录地址';

ii.
export function(){
    
    }
import * as 对象 from "此对象目录地址";

3.import introduces css in js. Such as: import 'animate.css';
4. @import introduces css in css. Such as: @import '/animate.css';

Guess you like

Origin blog.csdn.net/weixin_49295874/article/details/129216092