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