diff --git a/src/core/service/api/device/theme.js b/src/core/service/api/device/theme.js index 95de5a7ac1b062898f74048d1f7ff851ad8b21f5..49e5ffeb158435e272d63a6f1d096b8ba2543b1f 100644 --- a/src/core/service/api/device/theme.js +++ b/src/core/service/api/device/theme.js @@ -7,6 +7,7 @@ import { } from '../../platform' const callbacks = [] +const oldCallbacks = [] onMethod('onThemeChange', function (res) { callbacks.forEach(callbackId => { @@ -20,12 +21,12 @@ export function onThemeChange (callbackId) { // 旧版本 API,后期文档更新后考虑移除 onMethod('onUIStyleChange', function (res) { - callbacks.forEach(callbackId => { + oldCallbacks.forEach(callbackId => { invoke(callbackId, res) }) }) export function onUIStyleChange (callbackId) { - callbacks.push(callbackId) + oldCallbacks.push(callbackId) console.warn('The "uni.onUIStyleChange" API is deprecated, please use "uni.onThemeChange". Learn more: https://uniapp.dcloud.net.cn/api/system/theme.') }