|
@ -21,6 +21,10 @@ |
|
|
The file could not be uploaded. Maybe invalid format. |
|
|
The file could not be uploaded. Maybe invalid format. |
|
|
Please check available formats carefully. |
|
|
Please check available formats carefully. |
|
|
</v-alert> |
|
|
</v-alert> |
|
|
|
|
|
<h2>Example format</h2> |
|
|
|
|
|
<code class="mb-10 pa-5 highlight"> |
|
|
|
|
|
<span>{{ exampleFormat }}</span> |
|
|
|
|
|
</code> |
|
|
<h2>Select a file</h2> |
|
|
<h2>Select a file</h2> |
|
|
<v-file-input |
|
|
<v-file-input |
|
|
v-model="file" |
|
|
v-model="file" |
|
@ -42,7 +46,7 @@ export default { |
|
|
BaseCard |
|
|
BaseCard |
|
|
}, |
|
|
}, |
|
|
props: { |
|
|
props: { |
|
|
importLabel: { |
|
|
|
|
|
|
|
|
uploadLabel: { |
|
|
type: Function, |
|
|
type: Function, |
|
|
default: () => {}, |
|
|
default: () => {}, |
|
|
required: true |
|
|
required: true |
|
@ -57,6 +61,27 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
computed: { |
|
|
|
|
|
exampleFormat() { |
|
|
|
|
|
const data = [ |
|
|
|
|
|
{ |
|
|
|
|
|
text: 'Dog', |
|
|
|
|
|
suffix_key: 'a', |
|
|
|
|
|
background_color: '#FF0000', |
|
|
|
|
|
text_color: '#ffffff' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
text: 'Cat', |
|
|
|
|
|
suffix_key: 'c', |
|
|
|
|
|
background_color: '#FF0000', |
|
|
|
|
|
text_color: '#ffffff' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
console.log(JSON.stringify(data, null, 4)) |
|
|
|
|
|
return JSON.stringify(data, null, 4) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
cancel() { |
|
|
cancel() { |
|
|
this.$emit('close') |
|
|
this.$emit('close') |
|
@ -69,7 +94,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
create() { |
|
|
create() { |
|
|
if (this.validate()) { |
|
|
if (this.validate()) { |
|
|
this.importLabel({ |
|
|
|
|
|
|
|
|
this.uploadLabel({ |
|
|
projectId: this.$route.params.id, |
|
|
projectId: this.$route.params.id, |
|
|
file: this.file |
|
|
file: this.file |
|
|
}) |
|
|
}) |
|
@ -85,3 +110,13 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
|
|
.highlight { |
|
|
|
|
|
font-size: 100%; |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
} |
|
|
|
|
|
.highlight:before { |
|
|
|
|
|
content: '' |
|
|
|
|
|
} |
|
|
|
|
|
</style> |