Skip to content

Commit 8b2e522

Browse files
committed
release: v2.0.0-alpha.1
1 parent 143821c commit 8b2e522

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "@coreui/icons-vue",
3-
"version": "2.0.0-alpha.0",
3+
"version": "2.0.0-alpha.1",
44
"license": "MIT",
5-
"sideEffects": "src/CIcon.vue",
65
"main": "dist/index.js",
76
"module": "dist/index.es.js",
87
"jsnext:main": "dist/index.es.js",
@@ -45,6 +44,9 @@
4544
"build": "rollup -c",
4645
"lint": "eslint 'src/**/*.{js,ts,tsx}'"
4746
},
47+
"dependencies": {
48+
"vue": "^3.0.10"
49+
},
4850
"devDependencies": {
4951
"@typescript-eslint/eslint-plugin": "^4.28.5",
5052
"@typescript-eslint/parser": "^4.28.5",

src/CIcon.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const CIcon = defineComponent({
5757
},
5858
},
5959
setup(props, { attrs }) {
60-
6160
const icons: any = inject('icons')
6261
console.log(icons)
6362

@@ -98,25 +97,30 @@ const CIcon = defineComponent({
9897

9998
const viewBox = attrs.viewBox || `0 0 ${scale}`
10099

101-
// const size = () => {
102-
// const addCustom = !props.size && (attrs.width || attrs.height)
103-
// return props.size === 'custom' || addCustom ? 'custom-size' : props.size
104-
// }
105-
const classNames = props.customClasses || ['icon', { [`icon-${props.size}`]: props.size }]
100+
const size = () => {
101+
const addCustom = !props.size && (attrs.width || attrs.height)
102+
return props.size === 'custom' || addCustom ? 'custom-size' : props.size
103+
}
104+
105+
const classNames = (() => {
106+
return props.customClasses || ['icon', { [`icon-${size()}`]: size() }]
107+
})()
106108

107109
return () => [
108110
!props.src &&
109111
!props.use &&
110112
h('svg', {
113+
...attrs,
111114
xmlns: 'http://www.w3.org/2000/svg',
112115
class: classNames,
113116
viewBox: viewBox,
114-
innerHTML: `${titleCode} + ${iconCode}`,
117+
innerHTML: `${titleCode}${iconCode}`,
115118
role: 'img',
116119
}),
117120
props.src &&
118121
!props.use &&
119122
h('img', {
123+
...attrs,
120124
class: classNames,
121125
src: props.src,
122126
role: 'img',
@@ -126,6 +130,7 @@ const CIcon = defineComponent({
126130
h(
127131
'svg',
128132
{
133+
...attrs,
129134
xmlns: 'http://www.w3.org/2000/svg',
130135
class: classNames,
131136
role: 'img',

0 commit comments

Comments
 (0)