A,JS/CSSCDN remote and local import details

  • Local JS/CSS, stored in the static directory, reference, do not need to add /static directory, because /static directory will be mapped to/directory after compilation

  • Note that if the ES6 syntax file, such as export, is included in the JS file, do not use the configuration file to configure it, because an error will be reported. Instead, import it directly on the import page.

  • Test code (CDN remote, local)

Second, the globalJS/CSSCDN Remote and local import

  • Nuxt. Config. Js configuration

    The CSS import mode is the same as link and CSS import mode.

  • Use mode, directly use

  • Use effect

Second, a single pageJS/CSSCDN Remote and local import

  • Configured to use

    export default { head () { return { link: [ { rel: 'stylesheet', href: '/test.css' } ], script: {SRC: '/test.js'}} {SRC: '/test.js'} {SRC: '/test.js'} 'http://cdn.dengzemiao.cn/test.js' } ] } } }Copy the code

  • The effect is consistent with the global.