class KeyWordModel{

    key = 'q'

    maxLength = 10

    getHistory(){

        const words = wx.getStorageSync(this.Key)

        if(!words){

            return []

         }

        return words

    }

    addToHistory(keyword){

        let words = this.getHistory()

        const has = words.include(keyword)

        if(!has){

            const length = words.length

            if(length>=this.maxLength){

                words.pop();

             }

             words.unshift(keyword)

              wx.setStroageSync(this.key,words)

        }

    }

}