Skip to content

Commit 3a37269

Browse files
committed
fix: ignore attrs that might interfere with query generation
fix vuejs/vue-cli#1324
1 parent d3041e7 commit 3a37269

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/codegen/utils.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
const qs = require('querystring')
22

3+
// these are built-in query parameters so should be ignored
4+
// if the user happen to add them as attrs
5+
const ignoreList = [
6+
'id',
7+
'index',
8+
'src',
9+
'type'
10+
]
11+
312
// transform the attrs on a SFC block descriptor into a resourceQuery string
413
exports.attrsToQuery = (attrs, langFallback) => {
514
let query = ``
615
for (const name in attrs) {
716
const value = attrs[name]
8-
if (name !== 'src') {
17+
if (!ignoreList.includes(name)) {
918
query += `&${qs.escape(name)}=${value ? qs.escape(value) : ``}`
1019
}
1120
}

0 commit comments

Comments
 (0)