部分组件不再需要传递id

This commit is contained in:
LiYang
2016-08-14 16:23:55 +08:00
parent b05d4cbac2
commit 59b0aadbf9
3 changed files with 10 additions and 13 deletions

View File

@@ -35,8 +35,7 @@
</tr> </tr>
</table> </table>
<div class="form-group"> <div class="form-group">
<uploader uploader-id="testCaseUploader" <uploader upload-path="/"
upload-path="/"
:accept="{title: 'testcase zip', extensions: 'zip', mimeTypes: 'application/zip'}" :accept="{title: 'testcase zip', extensions: 'zip', mimeTypes: 'application/zip'}"
:upload-success="uploadSuccess" :upload-success="uploadSuccess"
:upload-error="uploadError" :upload-error="uploadError"

View File

@@ -1,5 +1,5 @@
<template> <template>
<textarea id="{{ editorid }}"></textarea> <textarea id="{{ editorId }}"></textarea>
</template> </template>
<script> <script>
import Simditor from 'simditor' import Simditor from 'simditor'
@@ -8,12 +8,8 @@
export default{ export default{
data() { data() {
return { return {
editor: {} editor: {},
} editorId: Math.random().toString(36).substr(2)
},
props: {
editorid: {
required: true
} }
}, },
methods: { methods: {
@@ -27,7 +23,7 @@
attached() { attached() {
var self = this; var self = this;
self.editor = new Simditor({ self.editor = new Simditor({
textarea: document.getElementById(self.editorid), textarea: document.getElementById(self.editorId),
upload: {url: "/", fileKey: "file"}, upload: {url: "/", fileKey: "file"},
toolbar: ['bold', 'italic', 'underline', 'color', 'image', 'ol', 'ul', 'markdown'] toolbar: ['bold', 'italic', 'underline', 'color', 'image', 'ol', 'ul', 'markdown']
}); });

View File

@@ -12,10 +12,12 @@
import getCookie from "../../utils/cookie" import getCookie from "../../utils/cookie"
export default ({ export default ({
props: { data() {
uploaderId: { return {
required: true, uploaderId: Math.random().toString(36).substr(2)
}
}, },
props: {
uploadPath: { uploadPath: {
required: true, required: true,
}, },