nuxt.config.js
plugins: [
'@/plugins/element-ui',
'@/plugins/swiper'
],
plugins/swiper.js
import Vue from 'vue'
//import VueAwesomeSwiper from 'vue-awesome-swiper'
// require styles
import 'swiper/dist/css/swiper.css'
export default () => {
if (process.browser) {
console.log('浏览器端渲染');
Vue.use(require('vue-awesome-swiper/dist/ssr'), /* { default global options } */)
}else{
console.log("非浏览器端渲染");
}
}
组件 page/index.vue
<template>
<section class="container">
<div v-swiper:mySwiper="swiperOption" @someSwiperEvent=