{
        template: '${tmpl}',
                data: function() {
                        return {
                                searchValue: null,
                                historySearch: [],
                        }
                },
        mounted: function() {
                if (localStorage.historySearch) {
                        let arr = JSON.parse(localStorage.historySearch);
                        this.historySearch = arr;
                }
        },
        created: function() {
                this.$root.hidemenu();

        },
        methods: {

                search(){
                        /**key是否存在 */
                        let { historySearch } = localStorage;
                        let data = this.searchValue;
                        this.searchValue = '';
                        if (!historySearch) {
                                let arr = [];
                                arr.push(data);
                                let str = JSON.stringify(arr);
                                localStorage.historySearch = str;
                        } else {
                                let arr = JSON.parse(historySearch);
                                arr.push(data);
                                if (arr.length > 10) {
                                        arr.shift();
                                }
                                let sortArr = arr.reverse();
                                let str = JSON.stringify([...new Set(arr)]);
                                localStorage.historySearch = str;
                        }
                         this.$router.push({ path: "/mobilesearchlist", query: { data } });
                },
                goBack(){
                        history.go(-1);
                },
                historyDel(index){
                        let arr = JSON.parse(localStorage.historySearch) ;
                        console.log(arr);
                        arr.splice(index, 1);
                        this.historySearch = arr;
                        localStorage.historySearch = JSON.stringify(arr);
                },
                historyItem(index,item){
                        this.searchValue = item;
                        let data = this.searchValue;
                        this.$router.push({ path: "/mobilesearchlist", query: { data } });
                },
                /*
                getLoginUser : function (){
                  var self =this;
                  this.$root.postReq("/web/userCtl/loginUser",{}).then(function(d){
                    if(d.status==0){
                      self.loginUser = d.data;
                    }
                  });
                }
                */
        },
        vname: "gsb-mobilesearch"
}
