我从 input type=file 重置图像文件时遇到了这个问题。这是场景,我设置了一个图像,然后我点击了“取消”按钮(这意味着它被重置了),然后我将再次设置相同的图像,它不会设置。我不知道为什么,但我认为这是一个错误。
这是我重置图像/表单的代码。
resetImage () {
this.$refs.addImageForm.reset()
this.dialog = ''
this.imgSrc = ''
this.fileName = ''
this.imgUrl = ''
this.file = ''
}
Run Code Online (Sandbox Code Playgroud)
如果有帮助,我正在使用 Vue.js 和 Vuetify。我希望你能帮助我。我被这个问题困住了
这是 HTML
<template>
<v-dialog
persistent
v-model="dialog"
width="600"
>
<template v-slot:activator="{ on }">
<v-btn depressed color="primary" v-on="on">
<v-icon class="pr-2">check</v-icon>Approve
</v-btn>
</template>
<v-card>
<div class="px-4 pt-3">
<span class="subheading font-weight-bold">Approve Details</span>
<input
ref="image"
type="file"
name="image"
accept="image/*"
style="display: none;"
@change="setImage"
/>
<v-layout row wrap align-center>
<v-flex xs12 class="pa-0">
<div class="text-xs-center">
<v-img :src="imgUrl" contain/>
</div>
<VueCropper …Run Code Online (Sandbox Code Playgroud) 请帮助我它总是说无法读取未定义的属性“提交”。这是我在 store.js 中的代码。
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
export const store = new Vuex.Store({
state:{
timer: null,
totaltime: (25 * 60)
},
mutations:{
startTimer: (state, context) => {
//here is the problem part I think
state.timer = setInterval(() => context.commit('countDown'),
1000)
},
countDown: state => {
var time = state.totaltime
if(time >= 1){
time--
}else{
time = 0
}
},
stopTimer: state => {
clearInterval(state.timer)
state.timer = null
},
resetTimer: state => {
state.totaltime = (25 …Run Code Online (Sandbox Code Playgroud)