发布于 2022-01-25 12:29:12
我检查了Buefy的文档,它似乎没有断点特性。
相反,您可以手动创建插件或在组件中添加以下内容:
<script>
export default {
data() {
return {
isMobile: false,
}
},
mounted() {
const mediaQuery = window.matchMedia('(min-width: 1024px)');
// Set initial value on first load.
this.isMobile = !mediaQuery.matches
// Listen for changes
mediaQuery.addEventListener('change', event => {
if (event.matches) {
console.log('>= 1024px');
this.isMobile = false;
} else {
console.log('< 1024px');
this.isMobile = true;
}
})
}
}
</script>https://stackoverflow.com/questions/70848287
复制相似问题