Skip to content

Commit 1bbd4d1

Browse files
authored
fix: custom delimiters in child contexts (#90)
1 parent ac072d1 commit 1bbd4d1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: src/context.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ export interface Context {
2121

2222
export const createContext = (parent?: Context): Context => {
2323
const ctx: Context = {
24+
delimiters: ['{{', '}}'],
25+
delimitersRE: /\{\{([^]+?)\}\}/g,
2426
...parent,
2527
scope: parent ? parent.scope : reactive({}),
2628
dirs: parent ? parent.dirs : {},
2729
effects: [],
2830
blocks: [],
2931
cleanups: [],
30-
delimiters: ['{{', '}}'],
31-
delimitersRE: /\{\{([^]+?)\}\}/g,
3232
effect: (fn) => {
3333
if (inOnce) {
3434
queueJob(fn)

Diff for: tests/custom-delimiters.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
</script>
77

88
<div v-scope="{ count: 1 }">
9-
<p>count is ${ count }!</p>
9+
<p v-if="count">count is ${ count }!</p>
1010
<button @click="count++">increase</button>
11+
12+
<p v-for="i in [1, 2, 3]" :key="i">${ i }</p>
13+
14+
<p v-if="true">${ count }</p>
1115
</div>

0 commit comments

Comments
 (0)