Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update vue-particles style across new input value online? #37

Open
ksuromanova opened this issue Jul 11, 2018 · 4 comments
Open

Comments

@ksuromanova
Copy link

Value updated, but style parcticles don`t update?
1
2

<template>	
	<div class="row wrap-banner">
		<vue-particles 	
			:particlesNumber="pNum"			
			:moveSpeed="mSpeed"		
			>				
		</vue-particles>
		<div class="col-md-7 skills-content ">
				<h1>Professional skills</h1>
				<ul>
					<li v-for="skill in skills">{{ skill }}</li>
				</ul>
		</div>	
		<div class="col-md-5">
			<form class="p-4">
				<div class="form-row">
					<div class="col-12 text-center">
						<h4>Particles options</h4>
					</div>
					<div class="form-group col-12 col-md-6">
						<label for="pNum">pNum</label>
						<input type="number" class="form-control myInput" 						 
						name="pNum"
						v-model.number="pNum"						
						/>
						<p>{{pNum}}</p>
					</div>
					<div class="form-group col-12 col-md-6">
						<label for="mSpeed">mSpeed</label>
						<input type="number" class="form-control myInput" 						 
						name="mSpeed"
						v-model.number="mSpeed"						
						/>
						<p>{{mSpeed}}</p>
					</div>
					<div class="col-md-12">
						<button class="btn btn-pink" type="button">Apply</button>
					</div>
				</div>
			</form>
		</div>		
	</div>		
</template>
<script>
import {mapGetters} from 'vuex';
  export default { 
  	data(){
  		return {
  			pNum: 150,
  		    mSpeed: 4	    
  		}
  	},
  	 computed: {
	      ...mapGetters('skills', {
	        skills: 'skills',
	      }) 
    }
  }
</script>	
@ko-fujita
Copy link

Me, too.

@ghost
Copy link

ghost commented Jan 21, 2019

Did you ever found a way?

@PavloNaumenko
Copy link

I've fixed this issue with reloading component. we need to assign a key to the vue-particles and create a watcher. For Example:

...
<vue-particles :particlesNumber="pNum" :key="particlesKey"></vue-particles>
...
  data() {
    return {
      particlesKey: 1
    };
  },
  watch: {
    pNum() {
      this.particlesKey++;
    },
  },

@DaWoCX
Copy link

DaWoCX commented May 5, 2020

Hey PavloNaumenko I tried it your way. It works but somehow it slows down everytime I change it (in my case the color and linesColor). Did you notice something similiar?

I've fixed this issue with reloading component. we need to assign a key to the vue-particles and create a watcher. For Example:

...
<vue-particles :particlesNumber="pNum" :key="particlesKey"></vue-particles>
...
  data() {
    return {
      particlesKey: 1
    };
  },
  watch: {
    pNum() {
      this.particlesKey++;
    },
  },

Hey PavloNaumenko I tried it your way. It works but somehow it slows down everytime I change it (in my case the color and linesColor). Did you notice something similiar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants