agreement.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="agreement-box">
  3. <view class="input-agreement animate__animated" :class="{'animate__shakeX':consentShake}" @click="setIsConsent" >
  4. <image class="agreement-agree" v-if="isConsent" src="/static/img/login/Checked1@3x.png" mode="aspectFill"></image>
  5. <image class="agreement-agree" v-else src="/static/img/login/Checked2@3x.png" mode="aspectFill"></image>
  6. <view class="agreement-text text-color-666 sys-size-24">已阅读并同意</view>
  7. <view class="agreement-text text-color-dominant sys-size-24">《隐私政策》</view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name:'agreement',
  14. data() {
  15. return {
  16. isConsent:false,
  17. consentShake:false
  18. };
  19. },
  20. methods:{
  21. setIsConsent(){
  22. this.isConsent=!this.isConsent
  23. this.$emit('input', this.isConsent)
  24. },
  25. setConsentShake(){
  26. this.consentShake=true
  27. console.log('consentShake:'+this.consentShake)
  28. setTimeout(()=>{
  29. this.consentShake=false
  30. },500)
  31. }
  32. }
  33. }
  34. </script>
  35. <style lang="scss">
  36. .agreement-box{
  37. margin-top: 25rpx;
  38. height: 32rpx;
  39. .input-agreement{
  40. display: flex;
  41. justify-content: flex-start;
  42. align-items: center;
  43. .agreement-agree{
  44. width: 32rpx;
  45. height: 32rpx;
  46. transition: .5s ease;
  47. }
  48. .agreement-text{
  49. margin-left: 18rpx;
  50. }
  51. }
  52. }
  53. </style>