Compare commits
No commits in common. "1df345e01257696dffb362f548ccc0b3a8767d1a" and "5cf8ddeb545e546bab4b496ba72f81a951521b49" have entirely different histories.
1df345e012
...
5cf8ddeb54
|
@ -3,7 +3,6 @@ import App from '../src/App.vue'
|
|||
|
||||
//基于element组件封装,引入element组件库
|
||||
import { Input } from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css';
|
||||
Vue.use(Input);
|
||||
|
||||
// 导入组件库
|
||||
|
|
|
@ -1,75 +1,77 @@
|
|||
<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",
|
||||
/**
|
||||
* 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,
|
||||
},
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: "small",
|
||||
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);
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: "",
|
||||
mounted() {
|
||||
// console.warn(this.$route.name);
|
||||
},
|
||||
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);
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
};
|
||||
</script>
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<Pedestal ref="ref_Pedestal" v-model="value">
|
||||
<Pedestal ref="ref_Pedestal" :options="options">
|
||||
<!-- <template #operate="">
|
||||
<el-button
|
||||
class="excel"
|
||||
|
@ -22,7 +22,6 @@ export default {
|
|||
components: { Pedestal },
|
||||
data() {
|
||||
return {
|
||||
value: "",
|
||||
options: {
|
||||
fnSearch: this.fnSearch,
|
||||
formItemAttrs: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function cloneDeep(obj, hash = new WeakMap()) {
|
||||
export default 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)
|
||||
|
@ -10,4 +10,4 @@
|
|||
deepObj[key] = cloneDeep(obj[key], hash)
|
||||
}
|
||||
return deepObj
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue