gyyg-components 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/babel.config.js +12 -0
- package/jsconfig.json +19 -0
- package/lib/demo.html +8 -0
- package/lib/gyyg-components.common.js +2045 -0
- package/lib/gyyg-components.umd.js +2055 -0
- package/lib/gyyg-components.umd.min.js +2055 -0
- package/package.json +50 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +17 -0
- package/src/App.vue +30 -0
- package/src/assets/images/down.png +0 -0
- package/src/components/GyygLayout/GyygLayout.js +5 -0
- package/src/components/GyygLayout/GyygLayout.vue +396 -0
- package/src/components/GyygModal/GyygModal.js +5 -0
- package/src/components/GyygModal/GyygModal.vue +327 -0
- package/src/components/GyygTable/GyygTable.js +5 -0
- package/src/components/GyygTable/GyygTable.vue +78 -0
- package/src/directive/el-drag-dialog/drag.js +64 -0
- package/src/directive/el-drag-dialog/index.js +13 -0
- package/src/directive/feeInput.js +48 -0
- package/src/directive/numberInput.js +32 -0
- package/src/icons/SvgIcon.vue +61 -0
- package/src/icons/index.js +9 -0
- package/src/icons/svg/down.svg +1 -0
- package/src/icons/svg/up.svg +1 -0
- package/src/icons/svgo.yml +22 -0
- package/src/index.js +45 -0
- package/src/main.js +15 -0
- package/src/utils/common.js +25 -0
- package/vue.config.js +24 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// 使用 require.context 动态导入所有组件
|
|
2
|
+
const modulesFiles = require.context("./components/", true, /\.js$/);
|
|
3
|
+
const components = modulesFiles.keys().reduce((components, modulePath) => {
|
|
4
|
+
// 排除自身这个文件
|
|
5
|
+
if (modulePath === "./index.js") return components;
|
|
6
|
+
// 获取组件名和组件配置
|
|
7
|
+
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, "$1");
|
|
8
|
+
const value = modulesFiles(modulePath);
|
|
9
|
+
components[moduleName] = value.default;
|
|
10
|
+
return components;
|
|
11
|
+
}, {});
|
|
12
|
+
|
|
13
|
+
const requireDirective = require.context(`./directive/`, false, /\.js$/);
|
|
14
|
+
|
|
15
|
+
// 定义 install 方法,接收 Vue 作为参数。
|
|
16
|
+
const install = function (Vue) {
|
|
17
|
+
if (install.installed) return;
|
|
18
|
+
// 遍历注册全局组件
|
|
19
|
+
Object.values(components).forEach((component) => {
|
|
20
|
+
// 如果组件提供了 install 方法,则使用 install 方法注册
|
|
21
|
+
if (typeof component.install === "function") {
|
|
22
|
+
Vue.use(component);
|
|
23
|
+
} else {
|
|
24
|
+
Vue.component(component.name, component);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
requireDirective.keys().forEach((directiveFileName) => {
|
|
28
|
+
const moduleName = directiveFileName.replace(/^\.\/(.*)\.\w+$/, "$1");
|
|
29
|
+
const directiveConfig = requireDirective(directiveFileName);
|
|
30
|
+
console.log(moduleName)
|
|
31
|
+
Vue.directive(moduleName, directiveConfig.default);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// 判断是否是直接引入文件
|
|
36
|
+
if (typeof window !== "undefined" && window.Vue) {
|
|
37
|
+
install(window.Vue);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
|
|
42
|
+
install,
|
|
43
|
+
// 以下是具体的组件列表
|
|
44
|
+
...components,
|
|
45
|
+
}
|
package/src/main.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import App from './App.vue'
|
|
3
|
+
|
|
4
|
+
Vue.config.productionTip = false
|
|
5
|
+
import { Dialog,Button,Pagination,Input } from 'element-ui';
|
|
6
|
+
Vue.use(Dialog)
|
|
7
|
+
Vue.use(Button)
|
|
8
|
+
Vue.use(Pagination)
|
|
9
|
+
Vue.use(Input)
|
|
10
|
+
// import zj from '@/index.js'
|
|
11
|
+
// Vue.use(zj)
|
|
12
|
+
import "./icons"; // icon
|
|
13
|
+
new Vue({
|
|
14
|
+
render: h => h(App),
|
|
15
|
+
}).$mount('#app')
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// 值判空
|
|
2
|
+
export function isEmpty(value) {
|
|
3
|
+
// null或undefined
|
|
4
|
+
if (value === null || value === undefined) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
// 空字符串
|
|
8
|
+
if (value === "") {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (JSON.stringify(value) === "{}") {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (JSON.stringify(value) === "[]") {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} path
|
|
21
|
+
* @returns {Boolean}
|
|
22
|
+
*/
|
|
23
|
+
export function isExternal(path) {
|
|
24
|
+
return /^(https?:|mailto:|tel:)/.test(path)
|
|
25
|
+
}
|
package/vue.config.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
function resolve(dir) {
|
|
3
|
+
return path.join(__dirname, dir);
|
|
4
|
+
}
|
|
5
|
+
module.exports = {
|
|
6
|
+
lintOnSave: false,
|
|
7
|
+
chainWebpack: (config) => {
|
|
8
|
+
config.module
|
|
9
|
+
.rule('svg')
|
|
10
|
+
.exclude.add(resolve('src/icons'))
|
|
11
|
+
.end();
|
|
12
|
+
config.module
|
|
13
|
+
.rule('icons')
|
|
14
|
+
.test(/\.svg$/)
|
|
15
|
+
.include.add(resolve('src/icons'))
|
|
16
|
+
.end()
|
|
17
|
+
.use('svg-sprite-loader')
|
|
18
|
+
.loader('svg-sprite-loader')
|
|
19
|
+
.options({
|
|
20
|
+
symbolId: 'icon-[name]'
|
|
21
|
+
})
|
|
22
|
+
.end();
|
|
23
|
+
},
|
|
24
|
+
};
|