先來看我作的效果 我這個是用的背景色加上這個粒子效果實現的demo 平時咱們作項目的話會添加背景圖片這些,可能更加好看 看個人實現步驟vue
cnpm install -g vue-cli vue init webpack star-project cnpm install vue-particles --save-dev
在main.js中引入webpack
//main.js import VueParticles from 'vue-particles' Vue.use(VueParticles)
在App.vue中寫入web
<vue-particles color="#fff" :particleOpacity="0.7" :particlesNumber="60" shapeType="circle" :particleSize="4" linesColor="#fff" :linesWidth="1" :lineLinked="true" :lineOpacity="0.4" :linesDistance="150" :moveSpeed="2" :hoverEffect="true" hoverMode="grab" :clickEffect="true" clickMode="push" class="lizi" > </vue-particles>
<template> <div id="app"> <!-- <img src="./assets/logo.png"> --> <vue-particles color="#fff" :particleOpacity="0.7" :particlesNumber="60" shapeType="circle" :particleSize="4" linesColor="#fff" :linesWidth="1" :lineLinked="true" :lineOpacity="0.4" :linesDistance="150" :moveSpeed="2" :hoverEffect="true" hoverMode="grab" :clickEffect="true" clickMode="push" class="lizi" > </vue-particles> <!-- <router-view/> --> </div> </template> <script> export default { name: 'App' } </script> <style> #app { font-family: 'Avenir', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; background:blue; /* margin-top: 60px; */ } </style>
運行項目,效果便可以出來vue-cli