💄(input): 修正 input 组件格式

This commit is contained in:
就眠儀式 2022-05-06 14:52:26 +08:00
parent 02c01b5944
commit eb2ed1001f
2 changed files with 6 additions and 5 deletions

View File

@ -31,7 +31,7 @@ const props = withDefaults(defineProps<LayInputProps>(), {
readonly: false, readonly: false,
allowClear: false, allowClear: false,
autofocus: false, autofocus: false,
autocomplete: false autocomplete: false,
}); });
const emit = defineEmits([ const emit = defineEmits([
@ -78,13 +78,13 @@ const onBlur = () => {
:placeholder="placeholder" :placeholder="placeholder"
:autofocus="autofocus" :autofocus="autofocus"
:autocomplete="autocomplete" :autocomplete="autocomplete"
:readonly="readonly"
:class="{ 'layui-disabled': disabled }" :class="{ 'layui-disabled': disabled }"
class="layui-input" class="layui-input"
@input="onInput" @input="onInput"
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
@change="onChange" @change="onChange"
:readonly="props.readonly"
/> />
<span class="layui-input-suffix" v-if="slots.suffix"> <span class="layui-input-suffix" v-if="slots.suffix">
<slot name="suffix"></slot> <slot name="suffix"></slot>

View File

@ -5,10 +5,10 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import layButton from "../button/index.vue"; import "./index.less";
import layInput from "../input/index.vue"; import layInput from "../input/index.vue";
import { LayIcon } from "@layui/icons-vue"; import { LayIcon } from "@layui/icons-vue";
import "./index.less"; import layButton from "../button/index.vue";
import { ref, watch, withDefaults, computed } from "vue"; import { ref, watch, withDefaults, computed } from "vue";
export interface LayInputNumberProps { export interface LayInputNumberProps {
@ -65,6 +65,7 @@ let timer: any = 0;
const minControl = computed( const minControl = computed(
() => props.min !== -Infinity && Number(props.min) >= num.value () => props.min !== -Infinity && Number(props.min) >= num.value
); );
const maxControl = computed( const maxControl = computed(
() => props.max !== Infinity && Number(props.max) <= num.value () => props.max !== Infinity && Number(props.max) <= num.value
); );
@ -141,4 +142,4 @@ const isNumber = function (num: any) {
/> />
</lay-button> </lay-button>
</div> </div>
</template> </template>