head() {
return {
title: this.$route.params.models.charAt(0).toUpperCase() + this.$route.params.models.slice(1).split('-').join(' ') + ' | ' + this.title,
meta: [
{ hid: 'description', name: 'description', content: '' }
]
}
}
我将如何处理?
如果仍然需要一种方法,请尝试使用此regex
模式
function capitalize(value){
return value.replace(/(?:^|\s|-)\S/g, x => x.toUpperCase());
}
console.log(capitalize('hello i misunderstood your requirement initially by skipping the whole description'))