Compare commits

...

22 Commits

Author SHA1 Message Date
baileijun e49e410488 护眼模式 2024-07-05 14:06:18 +08:00
qiaopengfei b86eb26f55 Merge pull request '组件' (#11) from qiaopengfei into master
Reviewed-on: #11
2024-07-03 16:34:17 +08:00
qiaopengfei 6834d27ca8 组件 2024-07-03 16:33:39 +08:00
qiaopengfei 5253a74f06 组件 2024-07-03 16:13:23 +08:00
qiaopengfei cdaa6a63d2 还原 2024-07-03 10:51:31 +08:00
qiaopengfei 7ddb64ceeb Merge pull request '全自动导入文件' (#10) from qiaopengfei into master
Reviewed-on: #10
2024-07-02 20:21:41 +08:00
qiaopengfei 3a26b24ce2 全自动导入文件 2024-07-02 20:17:16 +08:00
houhaobing 6c64010d0f Merge pull request 'update' (#9) from haobing into master
Reviewed-on: #9
2024-07-02 18:24:28 +08:00
XBing fa30fee27e update 2024-07-02 18:23:48 +08:00
houhaobing b05c05cf7d Merge pull request '222' (#8) from haobing into master
Reviewed-on: #8
2024-07-02 17:31:20 +08:00
XBing 36c6570a6e 222 2024-07-02 17:30:08 +08:00
houhaobing 35dd05fffd Merge pull request '组件' (#7) from qiaopengfei into master
Reviewed-on: #7
2024-07-02 17:21:27 +08:00
qiaopengfei 49c154d54b 组件 2024-07-02 17:13:44 +08:00
qiaopengfei c8ae6d2f7b Merge pull request 'qiaopengfei' (#6) from qiaopengfei into master
Reviewed-on: #6
2024-07-02 15:59:37 +08:00
qiaopengfei e73c078b04 Merge branch 'master' of https://git.aiguoai.com/baileijun/ag-element-ui into qiaopengfei 2024-07-02 15:59:18 +08:00
qiaopengfei e223c14d7e xiugai 2024-07-02 15:59:06 +08:00
qiaopengfei 1df345e012 Merge pull request '样式' (#5) from qiaopengfei into master
Reviewed-on: #5
2024-07-01 15:53:37 +08:00
qiaopengfei 0718254027 样式 2024-07-01 15:52:20 +08:00
qiaopengfei 5cf8ddeb54 Merge pull request 'qiaopengfei' (#4) from qiaopengfei into master
Reviewed-on: #4
2024-07-01 14:32:13 +08:00
qiaopengfei 9dbb3debe1 合并冲突 2024-07-01 14:30:28 +08:00
qiaopengfei c489660d1d fei 2024-07-01 14:27:49 +08:00
baileijun f4e4b3fb5d Merge pull request 'leijun' (#3) from leijun into master
Reviewed-on: #3
2024-07-01 14:24:39 +08:00
16 changed files with 320 additions and 134 deletions

View File

@ -1,5 +1,16 @@
module.exports = { module.exports = {
presets: [ presets: [
'@vue/cli-plugin-babel/preset' '@vue/cli-plugin-babel/preset',
["@babel/preset-env", { "modules": false }]
],
plugins: [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
] ]
} }

View File

@ -1,12 +1,17 @@
import Vue from 'vue' import Vue from 'vue'
import App from '../src/App.vue' import App from '../src/App.vue'
//基于element组件封装引入element组件库
import { Input, Select } from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Input);
Vue.use(Select);
// 导入组件库 // 导入组件库
import myui from '../packages' import erp_element_ui from '../packages'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(erp_element_ui)
Vue.use(myui)
new Vue({ new Vue({
render: h => h(App), render: h => h(App),

View File

@ -10,16 +10,18 @@
}, },
"main": "./lib/myErpElement.umd.min.js", "main": "./lib/myErpElement.umd.min.js",
"dependencies": { "dependencies": {
"core-js": "^3.6.5", "core-js": "^3.6.5"
"vue": "^2.6.11"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.5.19", "@vue/cli-plugin-babel": "~4.5.19",
"@vue/cli-plugin-eslint": "~4.5.19", "@vue/cli-plugin-eslint": "~4.5.19",
"@vue/cli-service": "~4.5.19", "@vue/cli-service": "~4.5.19",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"element-ui": "^2.15.14",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"vue": "^2.6.11",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
}, },
"eslintConfig": { "eslintConfig": {

View File

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

View File

@ -1,38 +0,0 @@
<template>
<div class="button">
<slot name="default" :datas="datas">{{ datas.a }}</slot>
</div>
</template>
<script>
export default {
name: 'mButton',
props: {
type: String
},
data() {
return {
datas:{
a:'666',
b:'successs'
}
}
},
}
</script>
<style scoped>
.button {
width: 100px;
border: 1px solid #000;
padding: .5rem;
margin: 0 auto;
}
.button:hover {
color: aliceblue;
background-color: orange;
}
</style>

View File

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

View File

@ -1,33 +0,0 @@
<template>
<div class="button">
<slot v-bind:data="name">{{ name.a }}</slot>
</div>
</template>
<script>
export default {
name: 'mButton1',
props: {
type: String
},
data() {
return {
name: { a: '777', b: '888' }
}
},
}
</script>
<style scoped>
.button {
width: 100px;
border: 1px solid #000;
padding: .5rem;
margin: 0 auto;
}
.button:hover {
color: aliceblue;
background-color: #000000;
}
</style>

View File

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

View File

@ -0,0 +1,18 @@
<template>
<div>
<h1>主组件</h1>
</div>
</template>
<script>
export default {
components: {},
data() {
return {};
},
methods: {},
};
</script>
<style scoped lang='scss'>
</style>

View File

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

View File

@ -0,0 +1,72 @@
<template>
<el-input
class="ag_input"
:style="{ width }"
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: "",
},
toUpperCase: {
type: Boolean,
default: true,
},
},
computed: {
attrs() {
return {
size: "small",
clearable: true, //
...this.$attrs,
};
},
//
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>

View File

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

View File

@ -0,0 +1,102 @@
<template>
<el-select
class="ag_select"
:style="{ width }"
:value="value"
:size="size"
v-on="inputListeners"
v-bind="attrs"
>
<el-option
v-for="(item, index) in options"
:key="index"
:label="item.label"
:value="item.value"
></el-option>
<!-- <slot name="options" slot="options" /> -->
</el-select>
</template>
<script>
import cloneDeep from "../../../src/utils/cloneDeep";
export default {
name: "agSelect",
props: {
width: {
type: String,
default: "",
},
value: {
type: String,
default: "",
},
size: {
type: String,
default: "small",
},
},
data() {
return {
model: "",
options: [],
};
},
computed: {
attrs() {
if (this.$attrs["remote-method"]) {
let obj = cloneDeep(this.$attrs);
Reflect.deleteProperty(obj, "remote-method");
return { ...obj, clearable: true, filterable: true, remote: true };
}
return false;
},
//
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);
},
}
);
},
},
watch: {
value: {
immediate: true,
handler(newVal) {
this.removeMethod(newVal);
this.model = newVal;
},
},
},
methods: {
async removeMethod(keywords) {
if (this.$attrs["remote-method"]) {
let opts = await this.$attrs["remote-method"](keywords);
this.options = opts;
}
},
handleChange(value) {
this.$emit("input", value);
},
},
};
</script>
<style lang="scss" scoped></style>

View File

@ -1,32 +1,32 @@
// 导入button组件 // 导入组件
import mButton from './Button/index' import agInput from './agInput/index'
import mButton1 from './Button1/index' import agSelect from './agSelect/index'
// 组件列表 // 组件列表
const components = [ const components = [
mButton, mButton1 agInput,
] agSelect
]
// 定义 install 方法,接收 Vue 作为参数(使用 use 注册插件,那么所有的组件都会被注册) // 定义 install 方法,接收 Vue 作为参数(使用 use 注册插件,那么所有的组件都会被注册)
const install = function (Vue) { const install = function (Vue) {
// 判断是否安装 // 判断是否安装
if (install.installed) return if (install.installed) return
// 遍历注册全局组件 // 遍历注册全局组件
components.map(component => Vue.component(component.name, component)) components.map(component => Vue.component(component.name, component))
} }
// 判断是否是直接引入文件 // 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) { if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue) install(window.Vue)
} }
export default { export default {
// 导出的对象必须具有 install才能被 Vue.use() 方法安装 // 导出的对象必须具有 install才能被 Vue.use() 方法安装
install, install,
} }
export { export {
install,
// 以下是具体的组件列表 // 以下是具体的组件列表
mButton, agInput,
mButton1, agSelect
} }

View File

@ -1,19 +1,45 @@
<template> <template>
<div> <div>
<moduleName></moduleName> <agSelect ref="ref_Pedestal" :value="value" @input="changeInput">
</agSelect>
</div> </div>
</template> </template>
<script> <script>
import moduleName from "../packages/Button/src/index.vue"; import agSelect from "../packages/agSelect/src/index";
export default { export default {
components: { moduleName }, components: { agSelect },
data() { data() {
return {}; return {
value: "",
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
};
},
methods: {
changeInput() {
// console.log(this.value);
},
}, },
methods: {},
}; };
</script> </script>
<style scoped lang='scss'> <style>
body {
background: #81aa6e;
}
</style> </style>

12
src/utils/cloneDeep.js Normal file
View File

@ -0,0 +1,12 @@
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)
if (hash.has(obj)) return hash.get(obj)
let deepobj = Array.isArray(obj) ? [] : Object.create(Object.getPrototypeOf(obj))
hash.set(obj, deepobj)
for (const key in obj) {
deepobj[key] = cloneDeep(obj[key], hash);
}
return deepobj
}