关于Nuxt.js 出现HTMLElement is not define
此类问题,方法有毒牙提供的,也有评论区的大佬提供的,毒牙收集了一下,如有不对的地方,可以在评论区评论一下,让毒牙了解一下,改过自我。
方法一:
// nuxt.config.js 页面
global.HTMLElement = typeof window === 'undefined' ? Object : window.HTMLElement
export default {
// ...
}
方法二:
import Vue from 'vue'
export default () => {
if (process.browser) {
//console.log('浏览器端渲染');
Vue.use(require('element-ui'),require('element-ui/lib/locale/lang/en'))
} else {
//console.log("非浏览器端渲染");
}
}
方法三:
plugins: [
// '@/plugins/element-ui',
{ src: '@/plugins/element-ui', ssr: false}
],