1. function removePrefixSort (sortArr) {
    2. // 在内部排序规则中调用去前缀方法 以实现具体的排序
    3. return sortArr.sort((a, b) => delPrefix(a) > delPrefix(b) ? 1 : -1)
    4. }
    5. // 返回去除指定前缀后的字符串
    6. function delPrefix (item) {
    7. return item.replace(/^(xtt|code|js)-/, '')
    8. }
    9. removePrefixSort( ['xtt-sort', 'code-clear', 'js-array', 'node','code-echo', 'js-symbol', 'css', 'xtt-romove'])
    10. // ['js-array', 'code-clear', 'css', 'code-echo', 'node', 'xtt-romove', 'xtt-sort', 'js-symbol']