Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 5e390e4

Browse files
authored
fix: use regex to extract component and style index (#129)
1 parent 0027e9f commit 5e390e4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ export default function vue (opts = {}) {
4747
load (id) {
4848
if (id.indexOf('.vue.component.') < 0) return null
4949

50-
const parts = id.split('.')
51-
const component = parts.slice(0, parts.length - 4).join('.')
52-
const index = parseInt(parts[parts.length - 4])
50+
const component = id.replace(/\.[\d]+\.vue.component.*$/, '')
51+
const index = parseInt(id.replace(`${component}.`, '').split('.')[0])
5352

5453
if (index < styles[component].length) return styles[component][index]
5554
},

0 commit comments

Comments
 (0)