Merge pull request '222' (#8) from haobing into master

Reviewed-on: #8
This commit is contained in:
houhaobing 2024-07-02 17:31:20 +08:00
commit b05c05cf7d
3 changed files with 3 additions and 87 deletions

View File

@ -1,9 +1,9 @@
// 导入button组件
import pedestal from './pedestal/src/index.vue'
import Input from './Input/src/index.vue'
// 组件列表
const components = [
pedestal,
Input,
]
// 定义 install 方法,接收 Vue 作为参数(使用 use 注册插件,那么所有的组件都会被注册)
@ -26,5 +26,5 @@ export default {
export {
install,
// 以下是具体的组件列表
pedestal,
Input,
}

View File

@ -1,9 +0,0 @@
import pedestal from './src'
// 为组件提供 install 安装方法,供按需引入
pedestal.install = function (Vue) {
Vue.component(pedestal.name, pedestal)
}
// 导出组件
export default pedestal

View File

@ -1,75 +0,0 @@
<template>
<el-input
class="ag_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: "AgInput",
props: {
width: {
type: String,
default: "",
},
size: {
type: String,
default: "small",
},
value: {
type: String,
default: "",
},
toUpperCase: {
type: Boolean,
default: false,
},
},
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>
<style lang="scss" scoped></style>