使用插件inobounce(但是只適用于ios系統(tǒng),安卓不適用)
下載插件:
npm install inobounce -s
在需要處理的頁(yè)面上添加如下代碼:
vue2
<script>
import inobounce from 'inobounce'
export default {
data() {
return { }
},
mounted() { },
created() {
let u = navigator.userAgent
if (u.indexOf('iPhone') > -1) {
inobounce.enable()
}
},
beforeDestroy() {
inobounce.disable()
},
methods: { }
}
</script>
vue3
import { onMounted } from "vue";
import inobounce from "inobounce";
onMounted(() => {
let u = navigator.userAgent;
if (u.indexOf("iPhone") > -1) {
inobounce.enable();
}
});