Files
wxapp_escort/miniprogram_npm/tdesign-miniprogram/config-provider/use-config.js
2026-05-28 17:06:18 +08:00

1 line
425 B
JavaScript

import{configStore}from"./config-store";export function getComponentLocale(e,o,t,n){var r;let c={};n&&(c=(null===(r=e.properties)||void 0===r?void 0:r[n])||{});const i=configStore.currentLocale.value,s=i&&i[o]||{};return Object.assign(Object.assign(Object.assign({},t),s),c)}export function useConfig(e){return{getLocale:(o,t)=>getComponentLocale(t,e,o),subscribeLocale:(e,o)=>configStore.currentLocale.subscribe(e=>{o(e)})}}