1.0.10 • Published 3 years ago

qcut v1.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

示例地址:https://zhicheng99.github.io/qcut/ 调用示例 npm.io

<template>
  <div id="app">
    <input
      id="file"
      type="file"
      @change="addImg"
      accept="image/png,image/jpeg,image/gif,image/jpg"
    />
    =============================
    <br />自由裁图:
    <div style="width: 200px; height: 300px">
      <qcut ref="qcut1" v-bind:file-obj="file" />
    </div>
    <span id="qcut1"></span>
    <button @click="cut1">裁图</button><br />
    ============================== <br />
    等比裁图
    <div style="width: 300px; height: 300px">
      <qcut
        ref="qcut2"
        v-bind:is-fixed="fixed"
        v-bind:fixed-ratio="ratio"
        v-bind:file-obj="file"
      />
    </div>

    <span id="qcut2"></span>
    <button @click="cut2">裁图</button><br />
    ============================== <br />
  </div>
</template>

<script>
import qcut from "./components/qcut";

export default {
  name: "App",
  components: {
    qcut,
  },
  data() {
    return {
      fixed: true,
      file: null,
      ratio: [2, 3],
    };
  },
  methods: {
    addImg: function (e) {
      this.file = e.target.files[0];
    },
    cut1: function () {
      document.getElementById("qcut1").innerHTML =
        '<img src="' + this.$refs.qcut1.getCropData() + '" />';
    },
    cut2: function () {
      document.getElementById("qcut2").innerHTML =
        '<img src="' + this.$refs.qcut2.getCropData() + '" />';
    },
  },
};
</script>

<style>
</style>
1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago