|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<input ref="input" type="text" style="visibility: hidden; position: absolute;" :value="src" />
|
|
|
|
|
<input ref="input" type="text" style="visibility: hidden; position: absolute;" :value="currentValue" />
|
|
|
|
|
<a ref="link" :href="src"><img ref="img" style="height:32px;" :src="src" /></a>
|
|
|
|
|
<br />
|
|
|
|
|
<button ref="btn" class="btn btn-sm btn-default" type="button" id="btn_Image" style="margin-top:5px;">上传</button>
|
|
|
|
@ -8,11 +8,17 @@
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
props: ['value'],
|
|
|
|
|
props: ['name', 'value', 'data'],
|
|
|
|
|
data: function () {
|
|
|
|
|
return {
|
|
|
|
|
currentValue: this.value
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
value(val) {
|
|
|
|
|
this.$emit('update:value', val)
|
|
|
|
|
},
|
|
|
|
|
currentValue(val) {
|
|
|
|
|
this.$emit('update:value', val);
|
|
|
|
|
this.$emit('change', this.name);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted: function () {
|
|
|
|
|
var vm = this;
|
|
|
|
@ -27,12 +33,14 @@
|
|
|
|
|
editor.plugin.fileDialog({
|
|
|
|
|
fileUrl: vm.src,
|
|
|
|
|
clickFn: function (url, title) {
|
|
|
|
|
$(vm.$refs.input).attr('value', url);
|
|
|
|
|
//if (isRequired) {
|
|
|
|
|
// $('#' + id).parents('form').validate().element('#' + id);
|
|
|
|
|
//}
|
|
|
|
|
$(vm.$refs.link).attr('href', vm.baseUrl + url);
|
|
|
|
|
$(vm.$refs.img).attr('src', vm.baseUrl + url);
|
|
|
|
|
//$(vm.$refs.input).attr('value', url);
|
|
|
|
|
////if (isRequired) {
|
|
|
|
|
//// $('#' + id).parents('form').validate().element('#' + id);
|
|
|
|
|
////}
|
|
|
|
|
//$(vm.$refs.link).attr('href', vm.baseUrl + url);
|
|
|
|
|
//$(vm.$refs.img).attr('src', vm.baseUrl + url);
|
|
|
|
|
vm.currentValue = url;
|
|
|
|
|
vm.$emit('change', vm.name);
|
|
|
|
|
editor.hideDialog();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -41,7 +49,7 @@
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
src: function () {
|
|
|
|
|
return this.value || '/images/empty.png';
|
|
|
|
|
return this.currentValue || '/images/empty.png';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|