在入口文件和組件中都引入了vue-awesome-muiimport Mui from 'vue-awesome-mui'import 'vue-awesome-mui/mui/dist/css/mui.css'import Vue from 'vue'Vue.use(Mui)但是在組件中這樣寫就會(huì)報(bào)錯(cuò)mui' is not defined我的目的就是想在這個(gè)組件中監(jiān)聽是否使用了物理返回鍵mounted () {
mui.init({
swipeBack: true
})
}我在index.html里面也有監(jiān)聽返回鍵但是這是全局監(jiān)聽 我也想在某一個(gè)組件中監(jiān)聽用戶是否使用了了返回鍵然后做一些操作 這個(gè)應(yīng)該怎么辦呢?<script>mui.init({ keyEventBind: { backbutton: true
}
});var first = null;
mui.back = function() { if (!first) {
first = new Date().getTime();
history.go(-1);
setTimeout(function() {
first = null;
}, 1000);
} else { if (new Date().getTime() - first < 1000) {
plus.runtime.quit();
}
}
};</script>
添加回答
舉報(bào)
0/150
提交
取消