Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion packages/compiler-core/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const tokenizer = new Tokenizer(stack, {
ondirname(start, end) {
const raw = getSlice(start, end)
const name =
raw === '.' || raw === ':'
raw === '.' || raw === ':' || raw === '!'
? 'bind'
: raw === '@'
? 'on'
Expand Down Expand Up @@ -353,6 +353,11 @@ const tokenizer = new Tokenizer(stack, {
}
} else {
// directive
const { rawName } = currentProp
if (rawName && rawName[0] === '!' && currentAttrValue === '') {
currentProp.rawName = `:${rawName.slice(1)}`
currentAttrValue = 'false'
}
let expParseMode = ExpParseMode.Normal
if (!__BROWSER__) {
if (currentProp.name === 'for') {
Expand Down
3 changes: 2 additions & 1 deletion packages/compiler-core/src/tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ export default class Tokenizer {
c === CharCodes.Dot ||
c === CharCodes.Colon ||
c === CharCodes.At ||
c === CharCodes.Number
c === CharCodes.Number ||
c === CharCodes.ExclamationMark
) {
this.cbs.ondirname(this.index, this.index + 1)
this.state = State.InDirArg
Expand Down
47 changes: 47 additions & 0 deletions packages/vue/examples/codemeow/useInversionValue.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script src="../../dist/vue.global.js"></script>
<script>
const { reactive, computed } = Vue

const AxisLabel = {
template: '<text>{{stat}} {{stat===false}} {{wode}}</text>',
props: {
stat: {
default: true,
type: Boolean
},
wode: {
default: false,
type: Boolean
}
},
setup(props) {
return {

}
},
}
</script>


<div id="demo">
<div class="zzz">
<input type="text" !value>
<axis-label !stat :nihao="false" wode></axis-label>
</div>
</div>

<script>
const { createApp } = Vue
createApp({
components: {
AxisLabel,
},
setup() {
return {}
},
}).mount('#demo')
</script>

<style>

</style>