diff --git a/src/components/editor/index.vue b/src/components/editor/index.vue index ca99c44..b927cd2 100644 --- a/src/components/editor/index.vue +++ b/src/components/editor/index.vue @@ -1,7 +1,7 @@ + + + @@ -97,6 +103,9 @@ const moduleList = ref([]); // 标签列表 const labelList = ref([]); +// 基本路径 +const viteUrl = import.meta.env.VITE_API_URL; + // 引入 api 请求接口 const artApi = articleApi(); @@ -171,11 +180,29 @@ const toEditArticle = (row: any) => { router.push({ path: '/article/edit', query: { id:row.id, moduleName: row.moduleName, labelName: row.labelName } }); } +// 复制链接 +const copyLink = (row: any) => { + if(row.id == null||row.id == ''){ ElMessage.warning('链接为空');return;} + var aux = document.createElement("input"); + aux.setAttribute("value", `${viteUrl}#article/content?id=${row.id}`); + document.body.appendChild(aux); + aux.select(); + document.execCommand("copy"); + document.body.removeChild(aux); + ElMessage.success('复制成功'); + aux.remove(); +} + // 文章详情 const toShowDetail = (row: any) => { router.push({ path: '/article/detail' , query: { id:row.id, moduleName: row.moduleName, labelName: row.labelName } }); } +// 预览 +const toPreview = (row: any) => { + window.open(`${viteUrl}#article/content?id=${row.id}`); +} + // 文章删除 const deleteArticle = (id: number) => { ElMessageBox.confirm('确定要删除该文章吗?', '提示', {