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

fix: use regex to extract component and style index #129

Merged
merged 1 commit into from
Sep 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ export default function vue (opts = {}) {
load (id) {
if (id.indexOf('.vue.component.') < 0) return null

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

if (index < styles[component].length) return styles[component][index]
},
Expand Down