菜单

头像自定义上传功能曝光澳门太阳集团:,js_脚本之家

2020年3月21日 - 新闻中心

头像自定义上传功能曝光澳门太阳集团:,js_脚本之家。之前写了一个上传头像的功能模块,以下的内容是描述上传头像过程中裁剪图片插件结合vue的一个使用。

猫和老鼠手游中自定义头像上传功能一直是玩家关注的焦点,但是小伙伴知道自定义上传功能怎么使用吗?今天小编就带着大家了解一下:

当然,使用就安装 npm install cropperjs

昨天更新的新版本中,头像自定义上传功能刚刚发布,喜欢的小伙伴可以试一试,让自己的头像变得多姿多彩,非常没关,充分体现出自己的个性来;

接着再引入import Cropper from 'cropperjs'

新功能使用注意事项一;达到30级后将解锁自定义头像上传功能,进入您的私人空间之后,进入【修改】-【修改头像】-【上传头像】,选择您心仪的照片进行上传;

       确定               import Cropper from 'cropperjs' export default { components: { }, data () { return { headerImage:'', picValue:'', cropper:'', croppable:false, panel:false, url:'' } }, mounted () { //&#21021;&#22987;&#21270;&#36825;&#20010;&#35009;&#21098;&#26694; var self = this; var image = document.getElementById; this.cropper = new Cropper(image, { aspectRatio: 1, viewMode: 1, background:false, zoomable:false, ready: function () { self.croppable = true; } }); }, methods: { getObjectURL  { var url = null ; if (window.createObjectURL!=undefined) { // basic url = window.createObjectURL ; } else if (window.URL!=undefined) { // mozilla url = window.URL.createObjectURL ; } else if (window.webkitURL!=undefined) { // webkit or chrome url = window.webkitURL.createObjectURL ; } return url ; }, change  { let files = e.target.files || e.dataTransfer.files; if  return; this.panel = true; this.picValue = files[0]; this.url = this.getObjectURL; //&#27599;&#27425;&#26367;&#25442;&#22270;&#29255;&#35201;&#37325;&#26032;&#24471;&#21040;&#26032;&#30340;url if{ this.cropper.replace; } this.panel = true; }, crop () { this.panel = false; var croppedCanvas; var roundedCanvas; if  { return; } // Crop croppedCanvas = this.cropper.getCroppedCanvas(); console.log // Round roundedCanvas = this.getRoundedCanvas; this.headerImage = roundedCanvas.toDataURL }, getRoundedCanvas  { var canvas = document.createElement; var context = canvas.getContext; var width = sourceCanvas.width; var height = sourceCanvas.height; canvas.width = width; canvas.height = height; context.imageSmoothingEnabled = true; context.drawImage(sourceCanvas, 0, 0, width, height); context.globalCompositeOperation = 'destination-in'; context.beginPath(); context.arc(width / 2, height / 2, Math.min / 2, 0, 2 * Math.PI, true); context.fill(); return canvas; }, postImg () { //&#36825;&#36793;&#20889;&#22270;&#29255;&#30340;&#19978;&#20256; } } }   *{ margin: 0; padding: 0; } #demo #button { position: absolute; right: 10px; top: 10px; width: 80px; height: 40px; border:none; border-radius: 5px; background:white; } #demo .show { width: 100px; height: 100px; overflow: hidden; position: relative; border-radius: 50%; border: 1px solid #d5d5d5; } #demo .picture { width: 100%; height: 100%; overflow: hidden; background-position: center center; background-repeat: no-repeat; background-size: cover; } #demo .container { z-index: 99; position: fixed; padding-top: 60px; left: 0; top: 0; right: 0; bottom: 0; background:rgba; } #demo #image { max-width: 100%; } .cropper-view-box,.cropper-face { border-radius: 50%; } /*! * Cropper.js v1.0.0-rc * https://github.com/fengyuanchen/cropperjs * * Copyright  2017 Fengyuan Chen * Released under the MIT license * * Date: 2017-03-25T12:02:21.062Z */ .cropper-container { font-size: 0; line-height: 0; position: relative; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; direction: ltr; -ms-touch-action: none; touch-action: none } .cropper-container img { /* Avoid margin top issue (Occur only when margin-top <= -height) */ display: block; min-width: 0 !important; max-width: none !important; min-height: 0 !important; max-height: none !important; width: 100%; height: 100%; image-orientation: 0deg } .cropper-wrap-box, .cropper-canvas, .cropper-drag-box, .cropper-crop-box, .cropper-modal { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } .cropper-wrap-box { overflow: hidden; } .cropper-drag-box { opacity: 0; background-color: #fff; } .cropper-modal { opacity: .5; background-color: #000; } .cropper-view-box { display: block; overflow: hidden; width: 100%; height: 100%; outline: 1px solid #39f; outline-color: rgba; } .cropper-dashed { position: absolute; display: block; opacity: .5; border: 0 dashed #eee } .cropper-dashed.dashed-h { top: 33.33333%; left: 0; width: 100%; height: 33.33333%; border-top-width: 1px; border-bottom-width: 1px } .cropper-dashed.dashed-v { top: 0; left: 33.33333%; width: 33.33333%; height: 100%; border-right-width: 1px; border-left-width: 1px } .cropper-center { position: absolute; top: 50%; left: 50%; display: block; width: 0; height: 0; opacity: .75 } .cropper-center:before, .cropper-center:after { position: absolute; display: block; content: ' '; background-color: #eee } .cropper-center:before { top: 0; left: -3px; width: 7px; height: 1px } .cropper-center:after { top: -3px; left: 0; width: 1px; height: 7px } .cropper-face, .cropper-line, .cropper-point { position: absolute; display: block; width: 100%; height: 100%; opacity: .1; } .cropper-face { top: 0; left: 0; background-color: #fff; } .cropper-line { background-color: #39f } .cropper-line.line-e { top: 0; right: -3px; width: 5px; cursor: e-resize } .cropper-line.line-n { top: -3px; left: 0; height: 5px; cursor: n-resize } .cropper-line.line-w { top: 0; left: -3px; width: 5px; cursor: w-resize } .cropper-line.line-s { bottom: -3px; left: 0; height: 5px; cursor: s-resize } .cropper-point { width: 5px; height: 5px; opacity: .75; background-color: #39f } .cropper-point.point-e { top: 50%; right: -3px; margin-top: -3px; cursor: e-resize } .cropper-point.point-n { top: -3px; left: 50%; margin-left: -3px; cursor: n-resize } .cropper-point.point-w { top: 50%; left: -3px; margin-top: -3px; cursor: w-resize } .cropper-point.point-s { bottom: -3px; left: 50%; margin-left: -3px; cursor: s-resize } .cropper-point.point-ne { top: -3px; right: -3px; cursor: ne-resize } .cropper-point.point-nw { top: -3px; left: -3px; cursor: nw-resize } .cropper-point.point-sw { bottom: -3px; left: -3px; cursor: sw-resize } .cropper-point.point-se { right: -3px; bottom: -3px; width: 20px; height: 20px; cursor: se-resize; opacity: 1 } @media  { .cropper-point.point-se { width: 15px; height: 15px } } @media  { .cropper-point.point-se { width: 10px; height: 10px } } @media  { .cropper-point.point-se { width: 5px; height: 5px; opacity: .75 } } .cropper-point.point-se:before { position: absolute; right: -50%; bottom: -50%; display: block; width: 200%; height: 200%; content: ' '; opacity: 0; background-color: #39f } .cropper-invisible { opacity: 0; } .cropper-bg { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC'); } .cropper-hide { position: absolute; display: block; width: 0; height: 0; } .cropper-hidden { display: none !important; } .cropper-move { cursor: move; } .cropper-crop { cursor: crosshair; } .cropper-disabled .cropper-drag-box, .cropper-disabled .cropper-face, .cropper-disabled .cropper-line, .cropper-disabled .cropper-point { cursor: not-allowed; }  

新功能使用注意事项二;照片审核将会需要一定的时间,请您耐心等待;

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

新功能使用注意事项三;审核中的照片不可更改,必须要审核通过才能拥有新的头像,待审核通过后,您的头像将自动更换为您已过审的照片;

新功能使用注意事项四;如照片已过审,再次上传照片需要等待3天的时间,如再次上传的照片通过审核,将会覆盖上一张照片成为新的头像;

好了,关于猫和老鼠手游头像新功能详解的介绍就到这里了,希望对您有帮助,我们下次再见。

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图