Git Product home page Git Product logo

element-plus-icons's Introduction

element-plus-icons's People

Contributors

chenxch avatar heappynd avatar hongbusi avatar iamkun avatar jw-foss avatar msidolphin avatar sxzz avatar xiaoxian521 avatar yunyoujun avatar zazzaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

element-plus-icons's Issues

[error] Uncaught (in promise) TypeError: (0 , _vue_reactivity__WEBPACK_IMPORTED_MODULE_1__.track)(...) is not a function

Uncaught (in promise) TypeError: (0 , vue_reactivity__WEBPACK_IMPORTED_MODULE_1_.track)(...) is not a function

安装引入都没有问题,在尝试在页面使用时,会出现此错误,未引用不会出现错误。
版本:"@element-plus/icons-vue": "^2.1.0",

<template>
<div>
  <el-row :gutter="20">
    <el-col :span="8">
      <el-button type="primary">
        <el-icon><Plus /></el-icon>
        添加组
      </el-button>

    </el-col>
    <el-col :span="16"><div class="grid-content ep-bg-purple" /></el-col>
  </el-row>
</div>
</template>
<script setup>
import { Plus } from '@element-plus/icons-vue'

</script>

image

main.js

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import App from './App.vue'
import router from './router'
import store from './store'

const app = createApp(App)
app.use(store).use(router).use(ElementPlus)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.mount('#app')

如何添加props

图标需要新增一个自定义props, 参试修改packages\vue\build\generate.ts

...
<script lang="ts">
import type { DefineComponent } from 'vue'
export default ({
  props:{data:String}, //新增
  name: "${componentName}",
}) as DefineComponent
</script>`
....

执行打包报错,输出src\components\qianggua.vue

<script lang="ts">
import type { DefineComponent } from 'vue'
export default {
  props: { data: String },
  name: 'Qiangua',
} as DefineComponent
</script>

生成代码可在 https://sfc.vuejs.org/ 运行。

// 更改导出 结果 正常
import { defineComponent } from 'vue'
export default defineComponent({
  name: 'Qiangua',
  props: {
    data:String,
  },
})
</script>

How to add svg icon globally [Question]

Hai @JeremyWuuuuu
Currently I'm upgrading from element plus 1.1.0-beta.24 to 1.2.0-beta.3

I because now all icon use svg icon, I have some breaking change

I have some button on my page like this (of course the button on the template and import on the script tag)

<el-button icon="el-icon-plus">Create</el-button>

and after upgrading the structure will be like this

<el-button :icon="Plus">Create</el-button>

import { Plus } from '@element-plus/icons'

For one page this is worth it, but for upgrading hundred page is very hard

My idea is use global component, so we not import on every page, and for icon="el-icon-plus" I can replace on vs code with :icon="Plus"
I try to use it on global component but not working

import { Plus } from '@element-plus/icons'
export default function (app) {
    app.component(Plus)
}

Can you help me

需要说明文档

官方说明文档是 0.0.11版本的,说明操作,图标显示不了。

希望提供新版本的使用说明。

The Element CSS style does not work properly

This is my code, rendering a close icon. However, attributes cannot be inherited correctly .
<el-icon :size="10" color="blue"> <ElIconClose /> </el-icon>
image

If I change it to the following it will work fine.

image

image

vite打包

build.ts中代码用vite打包该如何配置

执行pnpm build 报错

pnpm : 7.0.0-rc.2,
node: v16.14.2,
执行 pnpm build,

> @element-plus/[email protected] build D:\workspace\element-plus-icons\packages\vue
> pnpm run build:generate && pnpm run build:build && pnpm run build:types

> esno build/generate.ts

i generating vue components                                                                                                          13:15:11  
d:\workspace\element-plus-icons\packages\vue\build\generate.ts:14
  const { rootPath } = await getPackageInfo('@element-plus/icons-svg')
          ^

TypeError: Cannot destructure property 'rootPath' of '(intermediate value)' as it is undefined.
    at null.getSvgFiles (d:\workspace\element-plus-icons\packages\vue\build\generate.ts:14:11)
    at null.<anonymous> (d:\workspace\element-plus-icons\packages\vue\build\generate.ts:68:17)

[Bug Report] [Component] [icon] Icons missing "Left"

Bug Type: Component

Environment

  • Vue Version: 3.2.36
  • Element Plus Version: 2.2.2
  • Browser / OS: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
  • Build Tool: Webpack

Reproduction

Related Component

  • el-icon

Reproduction Link

Element Plus Playground

Steps to reproduce

Try to import the "Left" icon from the set.

What is Expected?

A "Left" icon should exist.

What is actually happening?

No exist error

Additional comments

There is an icon for Top, TopRight, Top Left, Right, Bottom, BottomRight, BottomLeft but no icon just for "Left".

tree shaking is not working?

I don't use the @element-plus/icons-vue package in my files, this package uses element-plus.
Can you tell me, maybe I'm doing something wrong?

node16.20.0版本, vue3+typescript 使用button icon的时候 ide会有个类型错误的警告信息

新建的空项目, 再button上使用Search等图标的时候, 会提示Search有问题, 代码运行起来样式没问题, 仅仅是个 警告

import {Search} from '@element-plus/icons-vue'

  <div>
    <el-button :icon="Search" circle/>
  </div>
Type DefineComponent<{}, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}> is not assignable to type string | Component
  "dependencies": {
    "@element-plus/icons-vue": "^2.1.0",
    "element-plus": "^2.3.8",
    "vue": "^3.2.47"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.1.0",
    "typescript": "^4.9.3",
    "vite": "^4.2.0",
    "vue-tsc": "^1.2.0"
  }

image

Search

在使用中一旦使Search图标项目就会出错createForOfIteratorHelper.js?b85c:3 Uncaught (in promise) TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

import icon error

version

"@element-plus/icons-vue": "^1.1.4",
"element-plus": "^1.0.2-beta.45",
"vue": "^3.0.5"

error log

[vite] error while updating dependencies:
Error: Build failed with 565 errors:
node_modules/@element-plus/icons-vue/dist/es/add-location.mjs:1:37: error: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "createElementBlock"
node_modules/@element-plus/icons-vue/dist/es/add-location.mjs:1:57: error: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "createElementVNode"
node_modules/@element-plus/icons-vue/dist/es/aim.mjs:1:37: error: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "createElementBlock"
node_modules/@element-plus/icons-vue/dist/es/aim.mjs:1:57: error: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "createElementVNode"
node_modules/@element-plus/icons-vue/dist/es/alarm-clock.mjs:1:37: error: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "createElementBlock"

@element-plus/icons-vue包无法被vite treeshake

在npm中的@element-plus/icons-vue包无法被vite treeshake。打包后,会把全部icon都打入包中。

反而是被标为deprecated的@element-plus/icons包可以被treeshake。

版本

  • @element-plus/icons-vue: 2.0.0
  • @element-plus/icons: 0.0.11
  • vite: 2.9.9

复现

直接从node_modules中的文件就能看出区别。

  1. pnpm create vite创建一个vite vue-ts项目
  2. 进入目录
  3. pnpm i @element-plus/icons @element-plus/icons-vue
  4. 找个地方使用icon(要实际使用,只import的话会被整个treeshake)
  5. pnpm build

可以发现从不同的包引用icon时,输出文件的大小有区别(53KB vs 255KB)。
输出文件中http://www.w3.org/2000/svg字符串的出现数目也能说明问题。

問錯地方了,請協助關閉

<script lang="ts" setup>
const tableData = [
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
]
</script>
<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="date" label="Date" width="180" />
    <el-table-column prop="name" label="Name" width="180" />
    <el-table-column prop="address" label="Address" />
  </el-table>
</template>

element-plus-best-practices
如此例,在App.vue 檢視時如資料寬度超過視窗寬度,會看不見後面的資料

从 rollup 到 esbuild 构建的目的

一直有在根据 element-plus-icons 学习搭建自己的 icons 依赖库,发现以前 element-plus-icons 一直是由 rollup 构建的,然后好像现在换成了 esbuild 构建的,这样好像对于按需引入似乎不太友好?请问这是出于什么样的原因呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.