如何对包含以句点为键的长字符串的对象进行解压缩



我有一个对象,它包含带点的字符串"travely.hintText.wealTags";作为密钥。(由我无法修改的api响应返回(。我想破坏内容对象,比如const{travely.hintText.wealTags}=content,但它会抛出错误。请让我知道如何销毁内容对象,非常感谢。

const content = {journey.hintText.journeyTags: 'Please select a tag'}

您可以使用计算属性,但您应该提供类似以下const { ['journey.hintText.journeyTags']: journeyTags } = content的名称

最新更新