This commit is contained in:
qiaopengfei 2024-07-01 15:52:20 +08:00
parent 9dbb3debe1
commit 0718254027
4 changed files with 71 additions and 71 deletions

View File

@ -3,6 +3,7 @@ import App from '../src/App.vue'
//基于element组件封装引入element组件库
import { Input } from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Input);
// 导入组件库

View File

@ -1,77 +1,75 @@
<template>
<el-input
class="w-input"
:style="{ width }"
:value="value"
:size="size"
v-on="inputListeners"
v-bind="[$attrs]"
>
<slot name="append" slot="append" />
<slot name="prefix" slot="prefix" />
<slot name="suffix" slot="suffix" />
<slot name="prepend" slot="prepend" />
</el-input>
</template>
<el-input
class="w-input"
:style="{ width }"
:value="value"
:size="size"
v-on="inputListeners"
v-bind="[$attrs]"
>
<slot name="append" slot="append" />
<slot name="prefix" slot="prefix" />
<slot name="suffix" slot="suffix" />
<slot name="prepend" slot="prepend" />
</el-input>
</template>
<script>
/**
* WInput
* @desc 处理输入的输入框(转大写不能有中文空格等)
*/
export default {
name: "WInput",
props: {
width: {
type: String,
default: "180px",
},
size: {
type: String,
default: "small",
},
value: {
type: String,
default: "",
},
toUpperCase: {
type: Boolean,
default: true,
},
/**
* WInput
* @desc 处理输入的输入框(转大写不能有中文空格等)
*/
export default {
name: "WInput",
props: {
width: {
type: String,
default: "180px",
},
computed: {
//
inputListeners() {
return Object.assign(
{},
//
this.$listeners,
//
//
{
// `v-model`
input: (value) => {
this.$emit("input", this.toUpperCase ? value.toUpperCase() : value);
},
blur: (e) => {
let value = e.target.value
.trim()
.replace(/\s/g, (match) =>
match.charCodeAt(0) === 12288 ? String.fromCharCode(32) : match
);
size: {
type: String,
default: "small",
},
value: {
type: String,
default: "",
},
toUpperCase: {
type: Boolean,
default: true,
},
},
computed: {
//
inputListeners() {
return Object.assign(
{},
//
this.$listeners,
//
//
{
// `v-model`
input: (value) => {
this.$emit("input", this.toUpperCase ? value.toUpperCase() : value);
},
blur: (e) => {
let value = e.target.value
.trim()
.replace(/\s/g, (match) =>
match.charCodeAt(0) === 12288 ? String.fromCharCode(32) : match
);
//
this.$emit("input", value);
},
}
);
},
//
this.$emit("input", value);
},
}
);
},
mounted() {
// console.warn(this.$route.name);
},
};
</script>
},
mounted() {},
};
</script>
<style lang="scss" scoped></style>

View File

@ -1,6 +1,6 @@
<template>
<div>
<Pedestal ref="ref_Pedestal" :options="options">
<Pedestal ref="ref_Pedestal" v-model="value">
<!-- <template #operate="">
<el-button
class="excel"
@ -22,6 +22,7 @@ export default {
components: { Pedestal },
data() {
return {
value: "",
options: {
fnSearch: this.fnSearch,
formItemAttrs: {

View File

@ -1,4 +1,4 @@
export default function cloneDeep(obj, hash = new WeakMap()) {
function cloneDeep(obj, hash = new WeakMap()) {
if (obj == null || typeof obj !== 'object') return obj
if (obj instanceof Date) return new Date(obj)
if (obj instanceof RegExp) return new RegExp(obj.source, obj.flags)