Skip to content

Commit

Permalink
fix(compiler): Allow BigInt usage in templates (#11152)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowings-zy authored Mar 30, 2021
1 parent 6940131 commit c42b706
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/instance/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (process.env.NODE_ENV !== 'production') {
const allowedGlobals = makeMap(
'Infinity,undefined,NaN,isFinite,isNaN,' +
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
'require' // for Webpack/Browserify
)

Expand Down
7 changes: 7 additions & 0 deletions test/unit/features/filter/filter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,11 @@ describe('Filters', () => {
it('support template string', () => {
expect(parseFilters('`a | ${b}c` | d')).toBe('_f("d")(`a | ${b}c`)')
})

it('bigint support', () => {
const vm = new Vue({
template: `<div>{{ BigInt(BigInt(10000000)) + BigInt(2000000000n) * 3000000n }}</div>`
}).$mount()
expect(vm.$el.textContent).toBe('6000000010000000')
})
})

0 comments on commit c42b706

Please sign in to comment.