@dataloop-ai/components 0.16.9 → 0.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
import { v4 } from 'uuid'
|
|
33
33
|
import { defineComponent } from 'vue-demi'
|
|
34
34
|
import { getColor, loggerFactory } from '../../../utils'
|
|
35
|
+
import { dynamicSvgImport } from '../../../utils/dynamicSvgImport'
|
|
35
36
|
|
|
36
37
|
export default defineComponent({
|
|
37
38
|
name: 'DlIcon',
|
|
@@ -104,7 +105,12 @@ export default defineComponent({
|
|
|
104
105
|
},
|
|
105
106
|
methods: {
|
|
106
107
|
loadSvg() {
|
|
107
|
-
return new Promise<void>((resolve, reject) => {
|
|
108
|
+
return new Promise<void>(async (resolve, reject) => {
|
|
109
|
+
let dynamicalImagePath = null
|
|
110
|
+
await dynamicSvgImport(this.icon).then((path: any) => {
|
|
111
|
+
dynamicalImagePath = path
|
|
112
|
+
})
|
|
113
|
+
|
|
108
114
|
const svgElement = new Image()
|
|
109
115
|
svgElement.setAttribute('height', this.size)
|
|
110
116
|
svgElement.setAttribute('width', this.size)
|
|
@@ -128,7 +134,7 @@ export default defineComponent({
|
|
|
128
134
|
try {
|
|
129
135
|
svgElement.src = this.svgSource
|
|
130
136
|
? `${this.svgSource}/${this.icon}.svg`
|
|
131
|
-
:
|
|
137
|
+
: dynamicalImagePath
|
|
132
138
|
} catch (e) {
|
|
133
139
|
reject(e)
|
|
134
140
|
}
|