zoukankan      html  css  js  c++  java
  • 小程序中使用lodash报错 | lodash小程序报错

    直接在小程序中使用lodash会报错,原因可参考

    https://blog.xinshangshangxin.com/2016/11/30/mina-lodash/

    在 import {_} from 'lodash' 之前先 import 'fix'

    fix.js

    /*fix.js*/
    /*
    修复lodash在小程序中不能使用问题*/ try { global.Array = Array } catch (e) { console.log('Array not support in MINA, skip') } try { global.Buffer = Buffer } catch (e) { console.log('Buffer not support in MINA, skip') } try { global.DataView = DataView } catch (e) { console.log('DataView not support in MINA, skip') } try { global.Date = Date } catch (e) { console.log('Date not support in MINA, skip') } try { global.Error = Error } catch (e) { console.log('Error not support in MINA, skip') } try { global.Float32Array = Float32Array } catch (e) { console.log('Float32Array not support in MINA, skip') } try { global.Float64Array = Float64Array } catch (e) { console.log('Float64Array not support in MINA, skip') } try { global.Function = Function } catch (e) { console.log('Function not support in MINA, skip') } try { global.Int8Array = Int8Array } catch (e) { console.log('Int8Array not support in MINA, skip') } try { global.Int16Array = Int16Array } catch (e) { console.log('Int16Array not support in MINA, skip') } try { global.Int32Array = Int32Array } catch (e) { console.log('Int32Array not support in MINA, skip') } try { global.Map = Map } catch (e) { console.log('Map not support in MINA, skip') } try { global.Math = Math } catch (e) { console.log('Math not support in MINA, skip') } try { global.Object = Object } catch (e) { console.log('Object not support in MINA, skip') } try { global.Promise = Promise } catch (e) { console.log('Promise not support in MINA, skip') } try { global.RegExp = RegExp } catch (e) { console.log('RegExp not support in MINA, skip') } try { global.Set = Set } catch (e) { console.log('Set not support in MINA, skip') } try { global.String = String } catch (e) { console.log('String not support in MINA, skip') } try { global.Symbol = Symbol } catch (e) { console.log('Symbol not support in MINA, skip') } try { global.TypeError = TypeError } catch (e) { console.log('TypeError not support in MINA, skip') } try { global.Uint8Array = Uint8Array } catch (e) { console.log('Uint8Array not support in MINA, skip') } try { global.Uint8ClampedArray = Uint8ClampedArray } catch (e) { console.log('Uint8ClampedArray not support in MINA, skip') } try { global.Uint16Array = Uint16Array } catch (e) { console.log('Uint16Array not support in MINA, skip') } try { global.Uint32Array = Uint32Array } catch (e) { console.log('Uint32Array not support in MINA, skip') } try { global.WeakMap = WeakMap } catch (e) { console.log('WeakMap not support in MINA, skip') } try { global._ = _ } catch (e) { console.log('_ not support in MINA, skip') } try { global.clearTimeout = clearTimeout } catch (e) { console.log('clearTimeout not support in MINA, skip') } try { global.isFinite = isFinite } catch (e) { console.log('isFinite not support in MINA, skip') } try { global.parseInt = parseInt } catch (e) { console.log('parseInt not support in MINA, skip') } try { global.setTimeout = setTimeout } catch (e) { console.log('setTimeout not support in MINA, skip') }

    本文地址:

    https://www.cnblogs.com/stumpx/p/13212266.html

  • 相关阅读:
    HTTP协议实体的基本讲解
    了解Xcode目录结构 开发者必看
    图解oracle 之从客户端到服务端的sql追击
    iPhone开发经典语录集锦
    iphone网络编程 http请求 get / post(发送二进制文件) 总结
    iPhone 路径大全
    http发送文件的原理
    iPhone开发面试题葵花宝典
    来自mooon的最简单的日志类CSimpleLogger
    不再担心日志文件过大:通用日志滚动脚本
  • 原文地址:https://www.cnblogs.com/stumpx/p/13212266.html
Copyright © 2011-2022 走看看