当前位置:首页 > 经验笔记 > VUE > 正文内容

基于Vue的移动端图片裁剪组件(vue-imgcut)

han32685年前 (2021-04-15)VUE4168

安装:

npm install vue-imgcut –save

使用代码:

<template>
    <div>
        <imgCut ref="Uppicinput" @callback="callback" :width="200" :height="200">
            <div>上传按钮</div>
        </imgCut>
        <img :src="imgsrc">
    </div>
</template>


<script>
import { imgCut } from 'vue-imgcut'
export default {
    components: {
        imgCut,
    },
    data() {
        return {
            imgsrc: '',
        }
    },
    methods: {
        callback(img) {
            this.imgsrc = img
            console.log(img)
        },
    },
}
</script>

<style scoped lang="less">

</style>

使用展示:

image.png


扫描二维码推送至手机访问。

版权声明:本文由瀚文博客发布,如需转载请注明出处。

本文链接:http://hanwenblog.com/post/52.html

分享给朋友:

相关文章

element中el-switch开关点击弹出确认框 阻止默认的el-switch 的点击事件 发送请求成功后才改变状态

element中el-switch开关点击弹出确认框 阻止默认的el-switch 的点击事件 发送请求成功后才改变状态

Switch 开关表示两种相互对立的状态间的切换,多用于触发「开/关」。常见用法: 1、绑定v-model到一个Boolean类型的变量。可以使用active-color属性与inactiv...

在vue中实现element-ui的el-dialog弹框拖拽

1.在assets/js/文件夹下新建directives.js 文件:import Vue from 'vue' // v-dialog...

vue-cli3.x不同环境打包运行不同api接口及打包后动态配置API地址

vue-cli3.x不同环境打包运行不同api接口及打包后动态配置API地址

今天接到一个测试反馈说“我能不能我直接打包测试环境项目不用手动去改API”我第一反应就是这个测试这么懒!改个API都嫌麻烦,但是仔细一想毕竟"懒惰使人进步"嘛! &nbs...

vue 去除前后空格trim的使用方法

一、使用trim修饰符<input v-model.trim = "massage" >二、使用filter过去属性 <...

基于Vue的移动端图片裁剪组件(Clipic)可自动压缩

基于Vue的移动端图片裁剪组件(Clipic)可自动压缩

安装:Bashnpm install --save clipic使用代码:Markup<template>     ...