Open rainbox-taojun opened 6 years ago
please demo a code for replicate
I'm sorry, reply is slow. I am using the VUE. After I import, particles is empty object, I don't know the correct usage,But in a few months ago, so I use can be successful.
Here is my part of the code
import particles from 'particles.js'
import particlesJSON from './particles.json'
....
export default {
name: 'login',
data () {
return {
}
},
methods: {
setBackground () {
particles.particlesJS('login-bg', particlesJSON)
},
},
created () {
},
mounted () {
this.setBackground()
}
}
I don't think particles.js
is designed to be import
ed since it assigns to window.particleJS
and doesn't utilize module.exports
this source code work
import 'particles.js'
declare var window:any;
@Component({ ...
async ionViewWillEnter() { window.particlesJS.load('particles-js', 'assets/particles.json'); }
..
particles {}proto: Object
index.js:9977 [Vue warn]: Error in mounted hook: "TypeError: WEBPACK_IMPORTED_MODULE_0_particlesjsdefault.a.particlesJS is not a function"
found in
---> at resources/assets/views/login/Login.vue