document.querySelector模块构建失败:SyntaxError:意外的令牌(92:9)

时间:2018-03-20 02:51:27

标签: javascript reactjs jsx

我试图找出为什么babel记录:模块构建失败:SyntaxError:意外的令牌(92:9)。为简洁起见,我只添加组件的开头和结尾。

class PlaylistSearchBar extends Component{

constructor(){

    this.state = {
        term: {
            tracks: [],
            playlists: [] 
        }
    };
}

error here --> document.querySelector(".search").addEventListener('click', function() {
         input = document.querySelector("input").value;
         this.searchForQueries(input);
    });

and here --> document.querySelector(".input-search").addEventListener('keyup', function(e) {

        var input = document.querySelector(".input-search").value;

        if (e.which === 13) {
                this.searchForQueries(input);
        }
    });

render(){
        return(
            <div class="main">
                    <div class="ui massive icon input">
                        <input type="text" placeholder="Search for a song or artist..." class="js-search input-search"/>
                        <i class="search icon js-submit"></i>
                    </div>
                    <button onclick="localStorageClear();" class="clear">Clear Playlist</button>
            </div>

            <div class="search-results js-search-results ui cards">

            </div>
        );
        <Playlist playlists = {this.state.term.playlists} setTracksToNil = {this.setState({tracks: []});} embedItems = {this.getEmbed}/>
    }
}

1 个答案:

答案 0 :(得分:0)

@Html.DropDownListFor(model => model.role, new SelectList((IEnumerable)ViewData["Roles"], "role1", "role1"), null, new { @class = "form-control" })