1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| const dirRE = /^v-|^@|^:|^#/
|
| const PROPS = ['id', 'class', 'style', 'inline-template']
|
| module.exports = {
| preTransformNode (el) {
| if (!el.attrsList) {
| return
| }
| el.attrsList.forEach(attr => {
| if (attr.bool) {
| if (!dirRE.test(attr.name) && !PROPS.includes(attr.name)) {
| delete el.attrsMap[attr.name]
| attr.name = ':' + attr.name
| attr.value = 'true'
| el.attrsMap[attr.name] = attr.value
| }
| }
| })
| }
| }
|
|