Vue+Element-Ui手写登录滑动验证码

1.vue模块采用el-dialog样式做修改

12345678910111213141516171819202122232425262728

​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;el-dialog&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;:show-close="false" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="imgCode.dialogVisible" width="450px" top="25vh">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;slot="title">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="dialog-title">&#x8BF7;&#x6ED1;&#x52A8;&#x9A8C;&#x8BC1;&#x7801;&#x8FDB;&#x884C;&#x9A8C;&#x8BC1;&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;style="float:right;margin-top: -3px;">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;el-button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;icon="el-icon-refresh" title="&#x5237;&#x65B0;&#x9A8C;&#x8BC1;&#x7801;" circle type="success" @click="getImg" />&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;el-button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;icon="el-icon-close" title="&#x5173;&#x95ED;&#x9A8C;&#x8BC1;" circle type="danger" @click="closeDialog" />&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;style="position:relative;top:0;">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;img&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;ref="bgImg" :src="imgCode.bigImg" alt="" class="bigImg">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;img&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;ref="sliderImg"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;:src="imgCode.smallImg"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;alt=""&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="smallImg"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;:style="{ top: imgCode.positionY+'px' }"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;@mousedown="(e)=>moveBtn(e,2)"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;</code><!--​<--></code><!--​<--></code><!--​<--></code></code></code><!--​<--></code><!--​<--></code><!--​<--></code></code><!--​<--></code><!--​<--></code><!--​<-->

&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;slot="footer" class="dialog-footer">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="slider-box">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="slider-text">&#x5411;&#x53F3;&#x6ED1;&#x52A8;&#x6ED1;&#x5757;&#x586B;&#x5145;&#x62FC;&#x56FE;&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;ref="btnImg" class="slider-icon" @mousedown="(e)=>moveBtn(e,1)">>>&#x200B;&#x200B;<code class="html keyword">&#x200B;button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;el-dialog&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;</code></code></code></code><!--​<--></code></code><!--​<--></code><!--​<--></code><!--​<-->

2.样式部分scss代码

1.弹窗自定义部分以及图片样式

12345678910111213141516171819202122232425262728293031323334353637

&#x200B;.el-dialog__body {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;10px&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;!important&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.bigImg{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;439px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;280px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.smallImg{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;60px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;60px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;absolute&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;//&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;38%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;1%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;2px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;//&#xA0; box-shadow:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;10px&#x200B;​​ &#x200B;#696969&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;//&#xA0;&#xA0;&#x200B;​​ &#x200B;border&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;1px&#x200B;​​ &#x200B;solid&#x200B;​​ &#x200B;#ccc&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;cursor&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;pointer&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-button--&#x200B;​​ &#x200B;small&#x200B;​​ &#x200B;.is-&#x200B;​​ &#x200B;circle&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.dialog-title {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-size&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;15px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;color&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;#2b3f57&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;text-align&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-weight&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;600&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-dialog__footer {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;0px&#x200B;​​ &#x200B;12px&#x200B;​​ &#x200B;14px&#x200B;​​ &#x200B;0px&#x200B;​​ &#x200B;!important&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-dialog__headerbtn {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;15px&#x200B;​​ &#x200B;!important&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-dialog__header {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding-bottom&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;

2.滑块样式

12345678910111213141516171819202122232425262728293031323334353637

&#x200B;.slider-box {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;background&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;#f7f9fa&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;color&#x200B;​​ &#x200B;: $light_gray;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;1px&#x200B;​​ &#x200B;solid&#x200B;​​ &#x200B;#e4e7eb&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;relative&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;45px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;100%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;margin&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;6px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;&:hover {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;box-shadow:&#xA0;&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;2px&#x200B;​​ &#x200B;$btnHover;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.slider-text {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-size&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;14px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;absolute&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;50%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;50%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;transform: translate(&#x200B;​​ &#x200B;-50%&#x200B;​​ &#x200B;,&#xA0;&#x200B;​​ &#x200B;-50%&#x200B;​​ &#x200B;);&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.slider-&#x200B;​​ &#x200B;icon&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;relative&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;54px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;44px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;line-height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;25px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;background&#x200B;​​ &#x200B;: $btn;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;text-align&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;center&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-size&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;17px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;color&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;#fff&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;cursor&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;pointer&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;outline&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;none&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;1px&#x200B;​​ &#x200B;solid&#x200B;​​ &#x200B;$btn;&#xA0;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;float&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;

3.vue-js滑动相关代码

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162

​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;moveBtn(e, key) {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const ele = e.target&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const startX = e.clientX&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const eleWidth = ele.offsetWidth&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const parentWidth =&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.bgImg.offsetWidth&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const MaxX = parentWidth - eleWidth&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;if&#x200B;​​ &#x200B;(key === 1) {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.sliderImg.style.transition =&#xA0;&#x200B;​​ &#x200B;''&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#xA0;&#x200B;​​ &#x200B;else&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.btnImg.style.transition =&#xA0;&#x200B;​​ &#x200B;''&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;ele.style.transition =&#xA0;&#x200B;​​ &#x200B;''&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;document.onmousemove = (e) => {&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const endX = e.clientX&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX = endX - startX&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;if&#x200B;​​ &#x200B;(key === 1) {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.sliderImg.style.left =&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX +&#xA0;&#x200B;​​ &#x200B;'px'&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#xA0;&#x200B;​​ &#x200B;else&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.btnImg.style.left =&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX +&#xA0;&#x200B;​​ &#x200B;'px'&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;if&#x200B;​​ &#x200B;(&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX <= 0) { ​< code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX = 0&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(key === 1) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.left = 0&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.left = 0&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX >= MaxX) {&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX = MaxX&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(key === 1) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.left = (parentWidth -&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.width) +&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'px'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.left = (parentWidth -&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.width) +&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'px'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;ele.style.transform =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'translateX('&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;+&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX +&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'px)'&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;e.preventDefault()&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;document.onmouseup = () => {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.loginTypeFlag ===&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'login'&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.loginInterface()&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.getSendCode()&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;ele.style.transition =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'.4s ease'&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;ele.style.transform =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'translateX(0)'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;document.onmousemove =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;null&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;document.onmouseup =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;null&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(key === 1) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.left =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'1%'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.top =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.imgCode.positionY&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.transition =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'0.4s ease'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.left =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'0'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.transition =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'0.4s ease'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;<!--=-->

以上便是完整滑动验证码代码

1.vue模块采用el-dialog样式做修改

12345678910111213141516171819202122232425262728

​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;el-dialog&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;:show-close="false" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="imgCode.dialogVisible" width="450px" top="25vh">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;slot="title">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="dialog-title">&#x8BF7;&#x6ED1;&#x52A8;&#x9A8C;&#x8BC1;&#x7801;&#x8FDB;&#x884C;&#x9A8C;&#x8BC1;&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;style="float:right;margin-top: -3px;">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;el-button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;icon="el-icon-refresh" title="&#x5237;&#x65B0;&#x9A8C;&#x8BC1;&#x7801;" circle type="success" @click="getImg" />&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;el-button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;icon="el-icon-close" title="&#x5173;&#x95ED;&#x9A8C;&#x8BC1;" circle type="danger" @click="closeDialog" />&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;style="position:relative;top:0;">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;img&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;ref="bgImg" :src="imgCode.bigImg" alt="" class="bigImg">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;img&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;ref="sliderImg"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;:src="imgCode.smallImg"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;alt=""&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="smallImg"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;:style="{ top: imgCode.positionY+'px' }"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;@mousedown="(e)=>moveBtn(e,2)"&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;</code><!--​<--></code><!--​<--></code><!--​<--></code></code></code><!--​<--></code><!--​<--></code><!--​<--></code></code><!--​<--></code><!--​<--></code><!--​<-->

&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;slot="footer" class="dialog-footer">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="slider-box">&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;class="slider-text">&#x5411;&#x53F3;&#x6ED1;&#x52A8;&#x6ED1;&#x5757;&#x586B;&#x5145;&#x62FC;&#x56FE;&#x200B;&#x200B;<code class="html keyword">&#x200B;span&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;<​< code>&#x200B;&#x200B;<code class="html keyword">&#x200B;button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;ref="btnImg" class="slider-icon" @mousedown="(e)=>moveBtn(e,1)">>>&#x200B;&#x200B;<code class="html keyword">&#x200B;button&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;div&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;&#x200B;<code class="html spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;&#x200B;&#x200B;<code class="html keyword">&#x200B;el-dialog&#x200B;</code>&#x200B;&#x200B;<code class="html plain">&#x200B;>&#x200B;</code>&#x200B;</code></code></code></code><!--​<--></code></code><!--​<--></code><!--​<--></code><!--​<-->

2.样式部分scss代码

1.弹窗自定义部分以及图片样式

12345678910111213141516171819202122232425262728293031323334353637

&#x200B;.el-dialog__body {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;10px&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;!important&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.bigImg{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;439px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;280px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.smallImg{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;60px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;60px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;absolute&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;//&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;38%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;1%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;2px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;//&#xA0; box-shadow:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;10px&#x200B;​​ &#x200B;#696969&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;//&#xA0;&#xA0;&#x200B;​​ &#x200B;border&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;1px&#x200B;​​ &#x200B;solid&#x200B;​​ &#x200B;#ccc&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;cursor&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;pointer&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-button--&#x200B;​​ &#x200B;small&#x200B;​​ &#x200B;.is-&#x200B;​​ &#x200B;circle&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.dialog-title {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-size&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;15px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;color&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;#2b3f57&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;text-align&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-weight&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;600&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-dialog__footer {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;0px&#x200B;​​ &#x200B;12px&#x200B;​​ &#x200B;14px&#x200B;​​ &#x200B;0px&#x200B;​​ &#x200B;!important&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-dialog__headerbtn {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;15px&#x200B;​​ &#x200B;!important&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;.el-dialog__header {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;padding-bottom&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#x200B;​​ &#x200B;}&#x200B;

2.滑块样式

12345678910111213141516171819202122232425262728293031323334353637

&#x200B;.slider-box {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;background&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;#f7f9fa&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;color&#x200B;​​ &#x200B;: $light_gray;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;1px&#x200B;​​ &#x200B;solid&#x200B;​​ &#x200B;#e4e7eb&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;relative&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;45px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;100%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;margin&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;6px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;&:hover {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;box-shadow:&#xA0;&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;2px&#x200B;​​ &#x200B;$btnHover;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.slider-text {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-size&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;14px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;absolute&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;50%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;50%&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;transform: translate(&#x200B;​​ &#x200B;-50%&#x200B;​​ &#x200B;,&#xA0;&#x200B;​​ &#x200B;-50%&#x200B;​​ &#x200B;);&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;.slider-&#x200B;​​ &#x200B;icon&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;position&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;relative&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;top&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;:&#x200B;​​ &#x200B;0&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;width&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;54px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;44px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;line-height&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;25px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;background&#x200B;​​ &#x200B;: $btn;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;text-align&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;center&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;font-size&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;17px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;color&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;#fff&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;cursor&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;pointer&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;outline&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;none&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;1px&#x200B;​​ &#x200B;solid&#x200B;​​ &#x200B;$btn;&#xA0;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;float&#x200B;​​ &#x200B;:&#xA0;&#x200B;​​ &#x200B;left&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;border-radius:&#xA0;&#x200B;​​ &#x200B;5px&#x200B;​​ &#x200B;;&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;

3.vue-js滑动相关代码

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162

​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;moveBtn(e, key) {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const ele = e.target&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const startX = e.clientX&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const eleWidth = ele.offsetWidth&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const parentWidth =&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.bgImg.offsetWidth&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const MaxX = parentWidth - eleWidth&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;if&#x200B;​​ &#x200B;(key === 1) {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.sliderImg.style.transition =&#xA0;&#x200B;​​ &#x200B;''&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#xA0;&#x200B;​​ &#x200B;else&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.btnImg.style.transition =&#xA0;&#x200B;​​ &#x200B;''&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;ele.style.transition =&#xA0;&#x200B;​​ &#x200B;''&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;document.onmousemove = (e) => {&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;const endX = e.clientX&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX = endX - startX&#xA0;&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;if&#x200B;​​ &#x200B;(key === 1) {&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.sliderImg.style.left =&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX +&#xA0;&#x200B;​​ &#x200B;'px'&#x200B;​​​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#xA0;&#x200B;​​ &#x200B;else&#x200B;​​ &#x200B;{&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.$refs.btnImg.style.left =&#xA0;&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX +&#xA0;&#x200B;​​ &#x200B;'px'&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;}&#x200B;​​ &#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;​​ &#x200B;if&#x200B;​​ &#x200B;(&#x200B;​​ &#x200B;this&#x200B;​​ &#x200B;.disX <= 0) { ​< code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX = 0&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(key === 1) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.left = 0&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.left = 0&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX >= MaxX) {&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX = MaxX&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(key === 1) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.left = (parentWidth -&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.width) +&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'px'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.left = (parentWidth -&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.width) +&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'px'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;ele.style.transform =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'translateX('&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;+&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.disX +&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'px)'&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;e.preventDefault()&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;document.onmouseup = () => {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.loginTypeFlag ===&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'login'&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.loginInterface()&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.getSendCode()&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;ele.style.transition =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'.4s ease'&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;ele.style.transform =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'translateX(0)'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;document.onmousemove =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;null&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;document.onmouseup =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;null&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;if&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;(key === 1) {&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.left =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'1%'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.top =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.imgCode.positionY&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.sliderImg.style.transition =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'0.4s ease'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;else&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;{&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.left =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'0'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript keyword">&#x200B;this&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;.$refs.btnImg.style.transition =&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript string">&#x200B;'0.4s ease'&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;&#x200B;<code class="javascript spaces">&#x200B;&#xA0;&#xA0;&#xA0;&#x200B;</code>&#x200B;&#x200B;<code class="javascript plain">&#x200B;}&#x200B;</code>&#x200B;<!--=-->

以上便是完整滑动验证码代码

Original: https://blog.51cto.com/u_15689678/5397748
Author: 草长莺飞飞满天
Title: Vue+Element-Ui手写登录滑动验证码

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/517204/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球