mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 20:17:52 +08:00
fix: allow an object's Symbols to be observed (#6704)
Attempting to parseFloat on a Symbol throws the error `Cannot convert a Symbol value to a string`. A Symbol can be cast to a string using `.toString()` or `String()` though, so explicitly casting before parsing resolves the issue, allowing `Vue.set` to be called on Symbols.
This commit is contained in:
parent
4361a2b3ae
commit
4fd2ce813c
@ -56,7 +56,7 @@ export function isRegExp (v: any): boolean {
|
||||
* Check if val is a valid array index.
|
||||
*/
|
||||
export function isValidArrayIndex (val: any): boolean {
|
||||
const n = parseFloat(val)
|
||||
const n = parseFloat(String(val))
|
||||
return n >= 0 && Math.floor(n) === n && isFinite(val)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user