use rsjx and vue-rx in vue-cli

225 views Asked by At

when I use rxjs and vue-rx in my vue-cli program,I refer to vue-rx docs and configure my program,but found ‘Rx is not defined‘,wish somebody can help me,thans a lot enter image description here

enter image description here

1

There are 1 answers

0
Weiyi On

Two solutions

1.import Rx before use. import Rx from 'rxjs/Rx'

2.define a global variable in ./build/webpack.base.conf.js,cause you use vue-cli.

plugins: [ new webpack.ProvidePlugin({ "window.Rx":"rxjs/Rx", "Rx":"rxjs/Rx" }) ]