js中用于判断字符串是否以指定字符串开头的startWith()方法
js中startWith()方法用于检测字符串是否以指定的字符串开头
'hello world'.startsWith('hello')
在vue中可以使用此方法检查路由地址
import {useRoute} from 'vue-router';
const route = useRoute();
let path= route.path;
path.startWith('/login');
'hello world'.startsWith('hello')
import {useRoute} from 'vue-router';
const route = useRoute();
let path= route.path;
path.startWith('/login');