Skip to content

Commit 0c9d5be

Browse files
committed
chore(formeidtor): 表单演示编辑支持生成预览链接
1 parent 13e9966 commit 0c9d5be

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

packages/demo/src/index/views/Demo/index.vue

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,40 @@
186186
handleCancel() {
187187
console.log('Cancel');
188188
},
189+
clipboard(value) {
190+
if (document.execCommand) {
191+
const input = document.createElement('input');
192+
document.body.appendChild(input);
193+
input.setAttribute('value', value);
194+
input.select();
195+
196+
document.execCommand('copy');
197+
document.body.removeChild(input);
198+
199+
return true;
200+
}
201+
202+
this.$message.info(value);
203+
return false;
204+
},
189205
handleSubmit() {
190206
console.log('Submit');
207+
if (this.$route.query.type === 'Test') {
208+
const genRoute = this.$router.resolve({
209+
query: {
210+
type: 'Test',
211+
schema: this.curSchemaCode,
212+
formData: this.curFormDataCode,
213+
uiSchema: this.curUiSchemaCode,
214+
errSchema: this.curErrorSchemaCode,
215+
}
216+
});
217+
const url = `${window.location.origin}${window.location.pathname}${genRoute.href}`;
218+
219+
if (this.clipboard(url)) {
220+
this.$message.success('复制预览地址成功');
221+
}
222+
}
191223
}
192224
}
193225
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Created by Liu.Jun on 2020/7/22 11:07 下午.
3+
*/
4+
5+
export default {
6+
schema: {
7+
title: '测试专用页',
8+
type: 'object',
9+
description: '请输入你的Schema',
10+
properties: {
11+
}
12+
}
13+
};

0 commit comments

Comments
 (0)