I want to use vue-swiper,
then npm install vue-router --save
<swiper v-ref:swiper
direction="horizontal"
:mousewheel-control="true"
:performance-mode="false"
:pagination-visible="true"
:pagination-clickable="true"
@slide-change-start="onSlideChangeStart"
@slide-change-end="onSlideChangeEnd">
<div>Page 1</div>
<div>Page 2</div>
<div>Page 3</div>
</swiper>
if (process.BROWSER_BUILD) {
require('vue-swiper')
}
import Swiper from 'vue-swiper';
export default {
components: {
Swiper
}
}
build: {
vendor: [ 'vue-swiper']
},
when I npm run dev
,
Open http://127.0.0.1:3333
Mon, 05 Jun 2017 06:36:08 GMT nuxt:render Rendering url /
[vue-router] Failed to resolve async component default: ReferenceError: window is not defined
[vue-router] uncaught error during route navigation:
ReferenceError: window is not defined
at D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:4620
at D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:4552
at t.exports (D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:4838)
at Object.<anonymous> (D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:706)
at e (D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:328)
at Object.<anonymous> (D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:447)
at e (D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:328)
at D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:416
at D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:421
at i.(anonymous function).exports (D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:81)
at Object.<anonymous> (D:\workspace\vue\forex_h5\node_modules\vue-swiper\dist\vue-swiper.js:7:199)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
Mon, 05 Jun 2017 06:36:08 GMT nuxt:render Rendering url /index.js.map
so, can you help me ?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c720">#c720</a>)</em></sub></div>