This commit is contained in:
syuilo 2018-02-18 22:14:51 +09:00
parent 211b62eb92
commit 43ee5267c2
5 changed files with 19 additions and 12 deletions

View File

@ -8,7 +8,8 @@ export default function(opts) {
title: o.title,
placeholder: o.placeholder,
default: o.default,
type: o.type || 'text'
type: o.type || 'text',
allowEmpty: o.allowEmpty
}
}).$mount();
d.$once('done', text => {

View File

@ -41,7 +41,7 @@ export default Vue.extend({
this.files = [file];
this.ok();
},
onChangeselection(files) {
onChangeSelection(files) {
this.files = files;
},
upload() {

View File

@ -148,7 +148,8 @@ export default Vue.extend({
(this as any).apis.input({
title: '%i18n:desktop.tags.mk-drive-browser-file-contextmenu.rename-file%',
placeholder: '%i18n:desktop.tags.mk-drive-browser-file-contextmenu.input-new-file-name%',
default: this.file.name
default: this.file.name,
allowEmpty: false
}).then(name => {
(this as any).api('drive/files/update', {
file_id: this.file.id,

View File

@ -15,13 +15,18 @@
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: ['folder', 'browser'],
props: ['folder'],
data() {
return {
hover: false,
draghover: false
};
},
computed: {
browser(): any {
return this.$parent;
}
},
methods: {
onClick() {
this.browser.move(this.folder);

View File

@ -3,14 +3,13 @@
<span slot="header" :class="$style.header">
%fa:i-cursor%{{ title }}
</span>
<div slot="content">
<div :class="$style.body">
<input ref="text" v-model="text" :type="type" @keydown="onKeydown" :placeholder="placeholder"/>
</div>
<div :class="$style.actions">
<button :class="$style.cancel" @click="cancel">キャンセル</button>
<button :class="$style.ok" disabled="!allowEmpty && text.length == 0" @click="ok">決定</button>
</div>
<div :class="$style.body">
<input ref="text" v-model="text" :type="type" @keydown="onKeydown" :placeholder="placeholder"/>
</div>
<div :class="$style.actions">
<button :class="$style.cancel" @click="cancel">キャンセル</button>
<button :class="$style.ok" :disabled="!allowEmpty && text.length == 0" @click="ok">決定</button>
</div>
</mk-window>
</template>
@ -44,6 +43,7 @@ export default Vue.extend({
mounted() {
if (this.default) this.text = this.default;
this.$nextTick(() => {
console.log(this);
(this.$refs.text as any).focus();
});
},