markdown编辑器里限制5M大小的图片上传
This commit is contained in:
parent
e6573a5ed8
commit
4dec32ae82
@ -176,7 +176,7 @@
|
||||
>
|
||||
</el-button>
|
||||
</el-col>
|
||||
<span v-else>{{ scope.row.name }}</span>
|
||||
<span v-else class="table-file-name">{{ scope.row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -903,7 +903,7 @@ export default {
|
||||
console.log('selectRowData', this.selectRowData)
|
||||
console.log('rowContextData', this.rowContextData)
|
||||
},
|
||||
// cell-style通过返回值可以实现样式变换利用传递过来的数组index循环改变样式
|
||||
// cell-style 通过返回值可以实现样式变换利用传递过来的数组index循环改变样式
|
||||
rowRed({ row, column, rowIndex, columnIndex }) {
|
||||
if (this.indexList.length < 1 && columnIndex === 2 && this.cellMouseIndex === rowIndex) {
|
||||
return { cursor: 'pointer', color: "#19ACF9" }
|
||||
@ -941,7 +941,6 @@ export default {
|
||||
// 单元格点击事件
|
||||
cellClick(row, column) {
|
||||
clearTimeout(this.Loop);
|
||||
console.log(column.index)
|
||||
if(this.editingIndex === -1) {
|
||||
const columnIndex = column.index
|
||||
if (columnIndex === 0) {
|
||||
@ -1618,6 +1617,11 @@ export default {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
/deep/ .el-table__row /deep/.table-file-name:hover {
|
||||
cursor: 'pointer';
|
||||
color: "#19ACF9"
|
||||
}
|
||||
|
||||
.searchClass{
|
||||
float: right;
|
||||
width: 30%;
|
||||
|
||||
@ -57,8 +57,17 @@
|
||||
},
|
||||
methods: {
|
||||
$imgAdd(pos, $file) {
|
||||
console.log('$file.length',$file.size)
|
||||
const maxSize = 1024 * 1024 * 5
|
||||
if($file.size > maxSize){
|
||||
this.$message({
|
||||
message: '请选择小于5M的图片! 大于5M的图片将无法上传',
|
||||
type: 'warning',
|
||||
duration: 3000,
|
||||
});
|
||||
return
|
||||
}
|
||||
// 第一步.将图片上传到服务器.
|
||||
console.log('pos',pos,'$file',$file)
|
||||
let data = new FormData();
|
||||
data.append('filename', this.filename)
|
||||
data.append('username', this.$store.state.user.name)
|
||||
@ -72,16 +81,14 @@
|
||||
* 2. 通过$refs获取: html声明ref : `<mavon-editor ref=md ></mavon-editor>,`$vm`为 `this.$refs.md`
|
||||
*/
|
||||
const url = process.env.VUE_APP_BASE_FILE_API + '/public/image/' + res.data
|
||||
console.log(url)
|
||||
this.$refs.md.$img2Url(pos, url);
|
||||
})
|
||||
},
|
||||
$imgDel() {
|
||||
|
||||
$imgDel(pos, $file) {
|
||||
console.log("del",pos,$file)
|
||||
},
|
||||
// 所有操作都会被解析重新渲染
|
||||
change(value, render){
|
||||
console.log('value',value)
|
||||
// render 为 markdown 解析后的结果[html]
|
||||
this.html = render;
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user