Commit c624f999 authored by renjintao's avatar renjintao

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product-rjt

parents 21918f08 f22906e5
......@@ -2,7 +2,7 @@
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('title')" prop="title" style="width:95%">
<FormItem :label="l('title')" prop="title" style="width: 95%">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
......@@ -22,7 +22,13 @@
</Col>
<Col span="24">
<FormItem :label="l('content')" prop="content ">
<Input v-model="entity.content" type="textarea" :rows="5"></Input>
<i-quill
v-model="entity.content"
:height="300"
border
v-paste="handleImg"
/>
<!-- <Input v-model="entity.content" type="textarea" :rows="5"></Input> -->
</FormItem>
</Col>
</Row>
......@@ -34,8 +40,12 @@
</template>
<script>
import Api from "./api";
import iQuill from "@/components/quill";
export default {
name: "Add",
components: {
iQuill,
},
data() {
return {
entity: {
......@@ -76,6 +86,27 @@ export default {
}
},
methods: {
handleImg(e) {
console.warn(e);
let file = null;
if (
e.clipboardData &&
e.clipboardData.items[0] &&
e.clipboardData.items[0].type &&
e.clipboardData.items[0].type.indexOf("image") > -1
) {
//这里就是判断是否有粘贴进来的文件且文件为图片格式
file = e.clipboardData.items[0].getAsFile();
let reader = new FileReader();
reader.readAsDataURL(file);
setTimeout(() => {
var img = '<img src="' + reader.result + '" alt=""/>';
this.entity.content += img;
}, 1000);
// new R
}
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
......
......@@ -2,7 +2,7 @@
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('title')" prop="title" style="width:95%">
<FormItem :label="l('title')" prop="title" style="width: 95%">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
......@@ -22,7 +22,13 @@
</Col>
<Col span="24">
<FormItem :label="l('content')" prop="content ">
<Input v-model="entity.content" type="textarea" :rows="5"></Input>
<i-quill
v-model="entity.content"
:height="300"
border
v-paste="handleImg"
/>
<!-- <Input v-model="entity.content" type="textarea" :rows="5"></Input> -->
</FormItem>
</Col>
</Row>
......@@ -34,8 +40,12 @@
</template>
<script>
import Api from "./api";
import iQuill from "@/components/quill";
export default {
name: "Edit",
components: {
iQuill,
},
data() {
return {
entity: {},
......@@ -90,6 +100,27 @@ export default {
}
});
},
handleImg(e) {
console.warn(e);
let file = null;
if (
e.clipboardData &&
e.clipboardData.items[0] &&
e.clipboardData.items[0].type &&
e.clipboardData.items[0].type.indexOf("image") > -1
) {
//这里就是判断是否有粘贴进来的文件且文件为图片格式
file = e.clipboardData.items[0].getAsFile();
let reader = new FileReader();
reader.readAsDataURL(file);
setTimeout(() => {
var img = '<img src="' + reader.result + '" alt=""/>';
this.entity.content += img;
}, 1000);
// new R
}
},
handleClose() {
this.$emit("on-close");
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment