HTMLElement is not define nuxt.js

關於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}
  ],
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章