如何禁用nuxt.js媒体查询中的插件vue.fullpage?
问题描述:
我遇到问题。如何在nuxt.js的媒体查询中禁用插件vue.fullpage? nuxt.config.js如何禁用nuxt.js媒体查询中的插件vue.fullpage?
module.exports = {
plugins: {
'~plugins/fullpage-vue.js'
}
}
全页,vue.js
import Vue from 'vue'
import 'animate.css'
import 'fullpage-vue/src/fullpage.css'
import VueFullpage from 'fullpage-vue'
if (screen && screen.width > 768) {
Vue.use(VueFullpage)
}
因此无法正常工作。 错误:屏幕未定义
答
这对我很有帮助。
if (screen.width > 768) {
Vue.use(VueFullpage)
console.log('fullPage init')
}
或者也许如果你需要使用SSR
if (process.browser) {
if (screen.width > 768) {
Vue.use(VueFullpage)
console.log('fullPage init')
}
}
但更好的办法是真正使用official vullpage被发布于2018年一月
如果你使用【官方全页的.js组件为Vue.js](https://alvarotrigo.com/vue-fullpage/),那么你可以使用响应选项。 – Alvaro