Trying to add a button with a custom function

This commit is contained in:
2020-09-09 19:34:04 +00:00
parent 84fb2fd6f6
commit d836371eaa
4 changed files with 15 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ npm i vue-audio-recorder --save
| upload-url | String | URL for uploading | | upload-url | String | URL for uploading |
| show-download-button | Boolean | If it is true show a download button. Default: true | | show-download-button | Boolean | If it is true show a download button. Default: true |
| show-upload-button | Boolean | If it is true show an upload button. Default: true | | show-upload-button | Boolean | If it is true show an upload button. Default: true |
| show-custom-button | Boolean | If true show another button linked to specific action. Default: true |
| before-upload | Function | Callback fires before uploading | | before-upload | Function | Callback fires before uploading |
| successful-upload | Function | Callback fires after successful uploading | | successful-upload | Function | Callback fires after successful uploading |
| failed-upload | Function | Callback fires after failure uploading | | failed-upload | Function | Callback fires after failure uploading |
@@ -50,6 +51,7 @@ npm i vue-audio-recorder --save
| pause-recording | Function | Callback fires after pause recording | | pause-recording | Function | Callback fires after pause recording |
| after-recording | Function | Callback fires after click the stop button or exceeding the time limit | | after-recording | Function | Callback fires after click the stop button or exceeding the time limit |
| select-record | Function | Callback fires after choise a record. Returns the record | | select-record | Function | Callback fires after choise a record. Returns the record |
| custom-callback | Function | Callback fires when clicking on the custom button |
## AudioPlayer props ## AudioPlayer props
| Prop | Type | Description | | Prop | Type | Description |

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -237,6 +237,7 @@
:filename="filename" :filename="filename"
:headers="headers" :headers="headers"
:upload-url="uploadUrl"/> :upload-url="uploadUrl"/>
<button v-if="showCustomButton" @click="customAction(record)"> Custom Action </button>
</div> </div>
</div> </div>
@@ -265,6 +266,7 @@
showDownloadButton : { type: Boolean, default: true }, showDownloadButton : { type: Boolean, default: true },
showUploadButton : { type: Boolean, default: true }, showUploadButton : { type: Boolean, default: true },
showCustomButton : {type: Boolean, default: false},
micFailed : { type: Function }, micFailed : { type: Function },
beforeRecording : { type: Function }, beforeRecording : { type: Function },
@@ -274,7 +276,8 @@
beforeUpload : { type: Function }, beforeUpload : { type: Function },
successfulUpload : { type: Function }, successfulUpload : { type: Function },
selectRecord : { type: Function }, selectRecord : { type: Function },
format : { type: String } customCallback : { type: Function },
format : { type: String }
}, },
data () { data () {
return { return {
@@ -352,6 +355,13 @@
sampleRate : this.sampleRate, sampleRate : this.sampleRate,
format : this.format format : this.format
}) })
},
customAction(record) {
if (this.customCallback) {
this.customCallback(record)
} else {
console.log(record)
}
} }
}, },
computed: { computed: {