Nuxt3使用Element Plus套件要注意的事


核心 — 注意import方式

  • 注意!最重要的!如果使用nuxt,組件一定要從element-plus/dist/index.full引入

    像是這樣

    import { ElAutocomplete } from 'element-plus/dist/index.full';
  • 有些組件要用ClientOnly包裹起來才行,像是ElAutoComplete

    <client-only> <ElAutocomplete clearable :prefix-icon="Search" :trigger-on-focus="false" v-model="searchVal" :placeholder="placeholder" :fetch-suggestions="handleSearch" @select="handleSelect" /> </client-only>

REF

Element Plus using nuxt3

https://glitch.com/edit/#!/nuxt-element-plus?path=components%2FExamples.vue%3A1%3A0