Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
149 views
in Technique[技术] by (71.8m points)

Webstrom不能识别${}

【已设置 -> Language & Frameworks -> JavaScript -> 选择EcmaScript 6

function checkRequired(inputArr){
    inputArr.forEach(function(input){
        if(input.value.trim()==="")
        {
            showError(input,'${getKeyword(input)}为必填项')
        }else{
            showSuccess(input);
        }

    })
}
function getKeyword(input){
    return input.placeholder.slice(3);
}

这里识别不了${getKeyword(input)}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
'${getKeyword(input)}为必填项'

不要用单引号,应该用``


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...