也就是截取指定字符串后的内容,方法很多,记一下自己常用的
import { last, split } from 'lodash-es';
const url = 'https://bc-files-test.xxx.com/lvmh/cms/User engagement.xlsx'
const fileName = last(split(url, '/')); // User engagement.xlsx
- split将字符串以指定符号分割成数组-lodash文档-split
- last取数组最后一位-lodash文档-last