Ts-eslint stopped me with the message "Invalid type "string | null" of template literal expression" when I was trying to execute authorization.
The value came from localstorage so it has to be null or string but also I have to combine it with Bearer.
onMounted(async ()=>{
let myToken = localStorage.getItem('token');
await axios.post(
'http://localhost:3000/getdocuments',
{headers:{'Authorisation':`Baerer ${myToken}`}}
)
.then((res)=>{
console.log(res);
})
.catch(err=>{
console.log(err);
})
})
Run Code Online (Sandbox Code Playgroud)
你好,我正在寻找一种在 vue 中创建监听器的方法,如下所示:
document.addEventListener('keydown', function(event){
if(event.key === "Escape"){
console.log('hello esc ');
}
});
Run Code Online (Sandbox Code Playgroud)
我需要更改“varr”的值
data(){
return{
varr: value
}
}
Run Code Online (Sandbox Code Playgroud)
任何时候当用户按下 esc btn 时。但它可能用于其他情况。请帮忙。