+14
-2
lines changedFilter options
+14
-2
lines changed Original file line number Diff line number Diff line change
@@ -143,14 +143,14 @@ export function processExpression(
143
143
// let is a local non-ref value, and we need to replicate the
144
144
// right hand side value.
145
145
// x = y --> isRef(x) ? x.value = y : x = y
146
-
const rVal = (parent as AssignmentExpression).right
146
+
const { right: rVal, operator } = parent as AssignmentExpression
147
147
const rExp = rawExp.slice(rVal.start! - 1, rVal.end! - 1)
148
148
const rExpString = stringifyExpression(
149
149
processExpression(createSimpleExpression(rExp, false), context)
150
150
)
151
151
return `${context.helperString(IS_REF)}(${raw})${
152
152
context.isTS ? ` //@ts-ignore\n` : ``
153
-
} ? ${raw}.value = ${rExpString} : ${raw}`
153
+
} ? ${raw}.value ${operator} ${rExpString} : ${raw}`
154
154
} else if (isUpdateArg) {
155
155
// make id replace parent in the code range so the raw update operator
156
156
// is removed
Original file line number Diff line number Diff line change
@@ -361,6 +361,7 @@ export default {
361
361
const count = ref(0)
362
362
const maybe = foo()
363
363
let lett = 1
364
+
let v = ref(1)
364
365
365
366
return (_ctx, _cache) => {
366
367
return (_openBlock(), _createBlock(_Fragment, null, [
@@ -372,6 +373,12 @@ return (_ctx, _cache) => {
372
373
}),
373
374
_createVNode(\\"div\\", {
374
375
onClick: _cache[3] || (_cache[3] = $event => (_isRef(lett) ? lett.value = count.value : lett = count.value))
376
+
}),
377
+
_createVNode(\\"div\\", {
378
+
onClick: _cache[4] || (_cache[4] = $event => (_isRef(v) ? v.value += 1 : v += 1))
379
+
}),
380
+
_createVNode(\\"div\\", {
381
+
onClick: _cache[5] || (_cache[5] = $event => (_isRef(v) ? v.value -= 1 : v -= 1))
375
382
})
376
383
], 64 /* STABLE_FRAGMENT */))
377
384
}
Original file line number Diff line number Diff line change
@@ -300,11 +300,14 @@ const myEmit = defineEmit(['foo', 'bar'])
300
300
const count = ref(0)
301
301
const maybe = foo()
302
302
let lett = 1
303
+
let v = ref(1)
303
304
</script>
304
305
<template>
305
306
<div @click="count = 1"/>
306
307
<div @click="maybe = count"/>
307
308
<div @click="lett = count"/>
309
+
<div @click="v += 1"/>
310
+
<div @click="v -= 1"/>
308
311
</template>
309
312
`,
310
313
{ inlineTemplate: true }
@@ -317,6 +320,8 @@ const myEmit = defineEmit(['foo', 'bar'])
317
320
expect(content).toMatch(
318
321
`_isRef(lett) ? lett.value = count.value : lett = count.value`
319
322
)
323
+
expect(content).toMatch(`_isRef(v) ? v.value += 1 : v += 1`)
324
+
expect(content).toMatch(`_isRef(v) ? v.value -= 1 : v -= 1`)
320
325
assertCode(content)
321
326
})
322
327
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4