HTML5 plus 報錯 Uncaught SyntaxError: Unexpected identifier at XXXX.html:1

最近使用 VUE2.X + muse-ui  + HTML5 plus 開發webApp 調用HTML5 plus報錯,錯誤提示以下

Uncaught SyntaxError: Unexpected identifier at XXXX.html:1

錯誤緣由:疑是VUE2.X組件加載完畢後  HTML5 plus 沒有加載完html

解決方法:在vue2.X 的beforeMount 函數中添加代碼以下:vue

beforeMount() {
    // H5 plus事件處理
    function plusReady(){
        console.log("已經加載plusReady");
    }
    if(window.plus){
        plusReady();
    }else{
        document.addEventListener('plusready', plusReady, false);
    }
}
相關文章
相關標籤/搜索