未验证 提交 4f37b7c3 编写于 作者: D Devosend 提交者: GitHub

fix space validate for create folder bug (#11106) (#11172)

(cherry picked from commit 2f2de7f9)
上级 9742502e
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const noSpace = (value: string) => {
return value.indexOf(' ') === -1
}
......@@ -19,6 +19,7 @@ import { defineComponent, toRefs, PropType } from 'vue'
import { NForm, NFormItem, NInput } from 'naive-ui'
import { useI18n } from 'vue-i18n'
import Modal from '@/components/modal'
import { noSpace } from '@/utils/trim'
import { useForm } from './use-form'
import { useFolder } from './use-folder'
......@@ -66,6 +67,7 @@ export default defineComponent({
<NForm rules={this.rules} ref='folderFormRef'>
<NFormItem label={t('resource.file.folder_name')} path='name'>
<NInput
allowInput={noSpace}
v-model={[this.folderForm.name, 'value']}
placeholder={t('resource.file.enter_name_tips')}
class='input-directory-name'
......
......@@ -19,6 +19,7 @@ import { defineComponent, toRefs, PropType, watch, computed } from 'vue'
import { NForm, NFormItem, NInput } from 'naive-ui'
import { useI18n } from 'vue-i18n'
import Modal from '@/components/modal'
import { noSpace } from '@/utils/trim'
import { useForm } from './use-form'
import { useModal } from './use-modal'
import type { IUdf } from '../types'
......@@ -97,6 +98,7 @@ export default defineComponent({
path='name'
>
<NInput
allowInput={this.fileEdit ? undefined : noSpace}
v-model={[this.folderForm.name, 'value']}
placeholder={t('resource.udf.enter_name_tips')}
class='input-directory-name'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册