Skip to content

Commit 713046d

Browse files
authored
feat: add @element-plus/nuxt (element-plus#56)
fix element-plus#50 close element-plus#47 close element-plus#32 close element-plus#36 close element-plus#27 close element-plus#23
1 parent 7203f97 commit 713046d

File tree

8 files changed

+79
-103
lines changed

8 files changed

+79
-103
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
🏗 Working in Progress
55
</pre>
66

7-
> Nuxt 3 is still beta, we may need to keep updating to adapt it.
8-
> It doesn't work very well yet.
9-
107
SSR Preview: <https://element-plus-nuxt.vercel.app/>
118

129
SSG Preview: <https://nuxt-starter.element-plus.org/>

app.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
<script setup>
2-
import { ID_INJECTION_KEY } from 'element-plus'
3-
4-
provide(ID_INJECTION_KEY, {
5-
prefix: 100,
6-
current: 0,
7-
})
82
</script>
93

104
<template>

components/Counter.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import { ElInputNumber } from "element-plus";
32
const { count } = useCount();
43
</script>
54

components/Examples.vue

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<template>
22
<el-dropdown class="m-4" type="primary">
33
<el-button type="primary">
4-
Dropdown List<el-icon class="el-icon--right"><arrow-down /></el-icon>
4+
Dropdown List
5+
<el-icon class="el-icon--right">
6+
<el-icon-arrow-down />
7+
</el-icon>
58
</el-button>
69
<template #dropdown>
710
<el-dropdown-menu>
@@ -16,7 +19,7 @@
1619

1720
<br />
1821

19-
<el-button class="m-4" @click="hello">Hello</el-button>
22+
<el-button :icon="ElIconView" class="m-4" @click="hello">Hello</el-button>
2023
<el-button class="m-4" type="primary" @click="hello">Hello</el-button>
2124
<el-button class="m-4" type="success" @click="helloSuccess">Hello</el-button>
2225

@@ -27,41 +30,28 @@
2730
<br />
2831

2932
<el-icon class="cursor-pointer">
30-
<Grape />
33+
<el-icon-grape />
3134
</el-icon>
3235
<el-icon class="cursor-pointer">
33-
<IceCream />
36+
<ElIconIceCream />
3437
</el-icon>
3538
<el-icon class="cursor-pointer mb-4">
36-
<IceDrink />
39+
<ElIconIceDrink />
3740
</el-icon>
3841

3942
<br />
4043

41-
<client-only>
42-
<el-config-provider :locale="zhCn">
43-
<el-date-picker
44-
v-model="timeValue"
45-
type="date"
46-
placeholder="请选择日期"
47-
></el-date-picker>
48-
</el-config-provider>
49-
</client-only>
44+
<el-config-provider :locale="zhCn">
45+
<el-date-picker
46+
v-model="timeValue"
47+
type="date"
48+
placeholder="请选择日期"
49+
/>
50+
</el-config-provider>
5051
</template>
5152

5253
<script setup lang="ts">
53-
import {
54-
ElIcon,
55-
ElButton,
56-
ElDropdown,
57-
ElDropdownMenu,
58-
ElDropdownItem,
59-
ElConfigProvider,
60-
ElDatePicker,
61-
ElMessage,
62-
} from "element-plus";
6354
import zhCn from "element-plus/es/locale/lang/zh-cn";
64-
import { Grape, IceCream, IceDrink, ArrowDown } from "@element-plus/icons-vue";
6555
6656
const timeValue = ref("");
6757
const hello = () => ElMessage.info("hello world");

components/Logos.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import { ElIcon } from 'element-plus'
3-
import { Plus } from '@element-plus/icons-vue'
42
</script>
53

64
<template>
@@ -9,7 +7,7 @@ import { Plus } from '@element-plus/icons-vue'
97
class="logo"
108
src="https://element-plus.org/images/element-plus-logo.svg"
119
/>
12-
<el-icon><Plus /></el-icon>
10+
<el-icon><ElIconPlus /></el-icon>
1311
<NuxtLogo class="logo" />
1412
</div>
1513
<h2>

nuxt.config.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import ElementPlus from 'unplugin-element-plus/vite'
2-
31
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
42
export default defineNuxtConfig({
53
app: {
@@ -21,25 +19,18 @@ export default defineNuxtConfig({
2119
// css
2220
css: ['~/assets/scss/index.scss'],
2321

24-
// build
25-
build: {
26-
transpile: ['element-plus/es'],
27-
},
28-
2922
typescript: {
3023
strict: true,
3124
shim: false,
3225
},
3326

34-
vite: {
35-
plugins: [ElementPlus()],
36-
},
37-
3827
// build modules
39-
modules: ['@vueuse/nuxt', '@unocss/nuxt', '@pinia/nuxt'],
40-
41-
// auto import components
42-
components: true,
28+
modules: [
29+
'@vueuse/nuxt',
30+
'@unocss/nuxt',
31+
'@pinia/nuxt',
32+
'@element-plus/nuxt',
33+
],
4334

4435
// vueuse
4536
vueuse: {
@@ -53,4 +44,8 @@ export default defineNuxtConfig({
5344
scale: 1.2,
5445
},
5546
},
47+
48+
elementPlus: {
49+
icon: 'ElIcon',
50+
},
5651
})

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,22 @@
1919
},
2020
"devDependencies": {
2121
"@element-plus/icons-vue": "^2.0.10",
22+
"@element-plus/nuxt": "^1.0.2",
2223
"@pinia/nuxt": "^0.4.6",
2324
"@unocss/nuxt": "^0.48.0",
2425
"@vueuse/nuxt": "^9.9.0",
2526
"element-plus": "^2.2.27",
2627
"nuxt": "^3.0.0",
2728
"sass": "^1.57.1",
2829
"typescript": "^4.9.4",
29-
"unplugin-element-plus": "^0.4.1",
3030
"vue-router": "^4.1.6"
3131
},
3232
"pnpm": {
3333
"peerDependencyRules": {
3434
"ignoreMissing": [
3535
"webpack",
36-
"vite"
36+
"vite",
37+
"vue"
3738
]
3839
}
3940
}

0 commit comments

Comments
 (0)