使用插件inobounce(但是只适用于ios系统,安卓不适用)
下载插件:
npm install inobounce -s
在需要处理的页面上添加如下代码: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();
}
});