UNPKG

@ithinkdt/core

Version:

iThinkDT Core

18 lines (17 loc) 409 B
import { watch } from 'vue' export function lang({ locale, headerField, localeFormatter }) { let _locale watch( locale, () => { _locale = locale.value }, { immediate: true, flush: 'sync' }, ) return (req, next) => { if (_locale) { req.headers.set(headerField, localeFormatter(_locale)) } return next(req) } }