直接在小程序中使用lodash会报错,原因可参考
在 import {_} from 'lodash' 之前先 import 'fix'文章来源:https://www.toymoban.com/news/detail-610782.html
/*fix.js*/
// 解决小程序使用lodash问题
global.Object = Object
global.Array = Array
// global.Buffer = Buffer
global.DataView = DataView
global.Date = Date
global.Error = Error
global.Float32Array = Float32Array
global.Float64Array = Float64Array
global.Function = Function
global.Int8Array = Int8Array
global.Int16Array = Int16Array
global.Int32Array = Int32Array
global.Map = Map
global.Math = Math
global.Promise = Promise
global.RegExp = RegExp
global.Set = Set
global.String = String
global.Symbol = Symbol
global.TypeError = TypeError
global.Uint8Array = Uint8Array
global.Uint8ClampedArray = Uint8ClampedArray
global.Uint16Array = Uint16Array
global.Uint32Array = Uint32Array
global.WeakMap = WeakMap
global.clearTimeout = clearTimeout
global.isFinite = isFinite
global.parseInt = parseInt
global.setTimeout = setTimeout
// module.exports global
原文链接:https://www.cnblogs.com/stumpx/p/13212266.html文章来源地址https://www.toymoban.com/news/detail-610782.html
到了这里,关于直接在小程序中使用lodash会报错,原因可参考的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!