diff --git a/lib/h5/main.js b/lib/h5/main.js index 821b6b7ccd88fa1ac79087c719c0ed15d21e3bce..2e415d370edb42d25f202b0a6ae6a153471190e8 100644 --- a/lib/h5/main.js +++ b/lib/h5/main.js @@ -19,6 +19,17 @@ const { getCurrentPages } = require('uni-platform/service/index') +// 与微信JS-SDK同名的方法 +// const sameNameApis = ['setClipboardData', 'getClipboardData', 'onUserCaptureScreen', 'openBluetoothAdapter', 'startBluetoothDevicesDiscovery', 'onBluetoothDeviceFound', 'stopBluetoothDevicesDiscovery', 'onBluetoothAdapterStateChange', 'getConnectedBluetoothDevices', 'getBluetoothDevices', 'getBluetoothAdapterState', 'closeBluetoothAdapter', 'writeBLECharacteristicValue', 'readBLECharacteristicValue', 'onBLEConnectionStateChange', 'onBLECharacteristicValueChange', 'notifyBLECharacteristicValueChange', 'getBLEDeviceServices', 'getBLEDeviceCharacteristics', 'createBLEConnection', 'closeBLEConnection', 'onBeaconServiceChange', 'onBeaconUpdate', 'getBeacons', 'startBeaconDiscovery', 'stopBeaconDiscovery', 'chooseImage', 'previewImage', 'getNetworkType', 'onNetworkStatusChange', 'openLocation', 'getLocation'] +// 默认会被iOS企业微信替换的方法 +const sameNameApis = ['chooseImage'] +sameNameApis.forEach(item => { + Object.defineProperty(uni, item, { + writable: false, + configurable: false + }) +}) + global.uni = uni global.wx = global.uni @@ -36,4 +47,4 @@ Vue.use(require('uni-view/plugins').default, { require('uni-core/vue') require('uni-platform/components') -require('uni-components') +require('uni-components')