Browse Source

增加弹出框组件

develop
zq 1 month ago
parent
commit
267bac6507
  1. 14
      examples/package-lock.json
  2. 238
      examples/src/App.vue
  3. 106
      packages/Breadcrumb/src/index.vue
  4. 7
      packages/GuipDialog/index.js
  5. 124
      packages/GuipDialog/src/index.vue
  6. 1
      packages/assets/drop-selected.svg
  7. BIN
      packages/assets/dropDown_expand.png
  8. BIN
      packages/assets/dropDown_open.png
  9. BIN
      packages/assets/table_empty.png
  10. 7
      packages/index.js
  11. 2
      packages/styles/index.css

14
examples/package-lock.json

@ -30,7 +30,7 @@
},
"..": {
"name": "@zhicheng1012/zhicheng-components",
"version": "1.0.18",
"version": "1.0.21",
"license": "MIT",
"dependencies": {
"async-validator": "^1.11.5",
@ -3218,9 +3218,9 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
},
"node_modules/@zhicheng1012/zhicheng-components": {
"version": "1.0.18",
"resolved": "https://registry.npmjs.org/@zhicheng1012/zhicheng-components/-/zhicheng-components-1.0.18.tgz",
"integrity": "sha512-bBbonkmlYC3JgPq0fCI8xJxG5NyhGiBjzl2hTADlPy3g/GySDtHFGITQPJUYtjT5RXdw13BHiFSEPv1R2XrArg==",
"version": "1.0.21",
"resolved": "https://registry.npmjs.org/@zhicheng1012/zhicheng-components/-/zhicheng-components-1.0.21.tgz",
"integrity": "sha512-cVW6uTEySEGF42k/Jd3kTNr4doGRkutLsnqAbyNx7ych/TOM6ovgSlpR8p3j6RS3NQGuVm2WmihSpEk9oCohGg==",
"dependencies": {
"async-validator": "^1.11.5",
"core-js": "^3.40.0"
@ -19478,9 +19478,9 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
},
"@zhicheng1012/zhicheng-components": {
"version": "1.0.18",
"resolved": "https://registry.npmjs.org/@zhicheng1012/zhicheng-components/-/zhicheng-components-1.0.18.tgz",
"integrity": "sha512-bBbonkmlYC3JgPq0fCI8xJxG5NyhGiBjzl2hTADlPy3g/GySDtHFGITQPJUYtjT5RXdw13BHiFSEPv1R2XrArg==",
"version": "1.0.21",
"resolved": "https://registry.npmjs.org/@zhicheng1012/zhicheng-components/-/zhicheng-components-1.0.21.tgz",
"integrity": "sha512-cVW6uTEySEGF42k/Jd3kTNr4doGRkutLsnqAbyNx7ych/TOM6ovgSlpR8p3j6RS3NQGuVm2WmihSpEk9oCohGg==",
"requires": {
"async-validator": "^1.11.5",
"core-js": "^3.40.0"

238
examples/src/App.vue

@ -243,17 +243,61 @@
</section>
<section class="demo-section">
<h2>开关组件</h2>
<h2>图标组件相关</h2>
<SvgIcon1 :iconPath="require(`../assets/home-bread.svg`)" defaultColor="#8A9099" :size="16"
activeColor="#006AFF" />
<svg-icon :size="16" :path="require('../assets/home-bread.svg')" :color="'#8A9099'"
:hoverColor="'#006AFF'" />
<svg-icon :size="16" :path="require('../assets/home-bread.svg')" :color="'#8A9099'" :hoverColor="'#006AFF'" />
<GuipToolTip placement="bottom" effect="light" content="点击进入编辑">
<SvgIcon1 :iconPath="require(`../assets/home-bread.svg`)" defaultColor="#8A9099" :size="16"
activeColor="#006AFF" />
</GuipToolTip>
</section>
<section class="demo-section">
<h2>弹出框组件相关</h2>
<div class="flex ele-item">
<GuipButton type="primary" :btnstyle="{ width: '300px' }" @click="openDialog">打开弹框标题巨左按钮居右
</GuipButton>
<GuipButton type="primary" :btnstyle="{ width: '300px' }" @click="openDialog1">打开弹框标题巨中按钮居中
</GuipButton>
<GuipButton type="primary" :btnstyle="{ width: '300px' }" @click="openDialog2">打开弹框-放弃原按钮自定义
</GuipButton>
<!-- <GuipButton type="primary" @click="openLoading" size="page">展示加载动画 2s</GuipButton> -->
</div>
</section>
<GuipDialog :dialogVisible="dialogVisible" title="自定义标题" :show-close-button="false"
:show-cancel-button="showCancelButton" @confirm="handleConfirm" @cancel="handleCancel" @close="handleClose"
@dialogVisibleChange="dialogVisibleChange">
<!-- 自定义内容 -->
<div>
<p>这是一个自定义内容的弹框</p>
</div>
</GuipDialog>
<GuipDialog type="center" :dialogVisible="dialogVisible1" title="自定义标题" @close="handleClose"
@dialogVisibleChange="dialogVisibleChange">
<!-- 自定义内容 -->
<div>
<p>这是一个自定义内容的弹框</p>
</div>
</GuipDialog>
<GuipDialog type="center" :dialogVisible="dialogVisible2" title="自定义标题、内容、按钮" :showFooterButton="false"
@close="handleClose" @dialogVisibleChange="dialogVisibleChange">
<!-- 自定义内容 -->
<div>
<p>这是一个自定义内容的弹框</p>
<p>这是一个自定义内容的弹框</p>
<p>这是一个自定义内容的弹框</p>
<p>这是一个自定义内容的弹框</p>
<!-- 样式自定义 -->
<div class="btns gap10 mt24" style="width:100%">
<GuipButton type="ignore">取消</GuipButton>
<GuipButton :btnstyle="{ width: '240px' }">咖啡不加糖喔</GuipButton>
</div>
</div>
</GuipDialog>
</el-form>
@ -264,11 +308,7 @@
export default {
data() {
return {
tableData10: [
{ name: '张三', age: 25, address: '北京市' },
{ name: '李四', age: 30, address: '上海市' }
],
content: '测试一下',
content:'测试一下',
domainOptions: [
{
value: '.chachongz.com',
@ -328,30 +368,33 @@ export default {
timer: null,
date1: '',
switchValue: true,
switchValue3: true,
switchValue1: 1,
switchValue2: '0',
dialogVisible1: false,
dialogVisible2: false,
dialogVisible: false,//
showCancelButton: true, //
showCloseButton: true, //
form: {
username: '',
language: '',
switchValue3: true,
switchValue3:true,
switchValue2: '0',
domain_set: '',
domainSuffix: '11',
domainSuffix1: '.chachongz.com',
card: '1',
card1: '20',
input1: '跨年的烟火,绽放天空',
input2: '',
input3: '',
},
languageOptions1: [
{ label: 'JavaScript', value: 'js', selectedLabel: 'JavaScripthhhhhhhhhh', id: '1', name: '麻辣烫' },
{ label: 'Python', value: 'py', selectedLabel: 'JavaScripthhhhhhhhhh', id: '10', name: '易烊千玺' },
{ label: 'Java', value: 'java', disabled: true, selectedLabel: 'JavaScripthhhhhhhhhh', id: '11', name: '王源' }, //
{ label: 'Go', value: 'go', selectedLabel: 'JavaScripthhhhhhhhhh', id: '12', name: '王俊凯' },
{ label: 'JavaScript', value: 'js', selectedLabel: '333提拉米苏33', id: '1', name: '麻辣烫' },
{ label: 'Python', value: 'py', selectedLabel: '柠檬茶', id: '10', name: '易烊千玺' },
{ label: 'Java', value: 'java', disabled: true, selectedLabel: '榴莲大福', id: '11', name: '王源' }, //
{ label: 'Go', value: 'go', selectedLabel: '444222麻辣烫', id: '12', name: '王俊凯' },
],
languageOptions: {
'20': '查重站',
@ -412,6 +455,7 @@ export default {
address: '上海市普陀区金沙江路 1518 弄',
price: '20',
age: 20,
statu:1,
//
edit_name: '王小虎', edit_address: '上海市普陀区金沙江路 1518 弄'
}, {
@ -420,6 +464,8 @@ export default {
address: '上海市普陀区金沙江路 151811 弄',
price: '10',
age: 30,
statu:1,
edit_name: '王小虎11', edit_address: '上海市普陀区金沙江路 151811 弄'
}, {
@ -427,6 +473,7 @@ export default {
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄',
price: '200',
statu:0,
}, {
date: '2016-05-01',
name: '王小虎',
@ -567,7 +614,7 @@ export default {
value: '选项1',
label1: '黄金hhhhhh',
id1: '1',
id2: '啊11哈哈',
id2: '1是打开快递吧',
label: '黄金糕'
}, {
value: '选项2',
@ -596,10 +643,18 @@ export default {
}],
}
},
components: {
},
created() {
console.log('当前组件注册情况:', this.$options.components)
mounted() {
// this.getList();
// this.getStagePurchase()
// this.$loadingFn.show()
// setInterval(()=>{
// this.$loadingFn.hide()
// },70000)
// this.timer = setTimeout(() => {
// this.$store.dispatch('hideLoading')
// }, 2000)
// this.timer = null;
},
computed: {
currentDomainItem() {
@ -607,11 +662,18 @@ export default {
}
},
methods: {
selectChangeTest(val) {
console.log(val, 'select-----选中的');
switchChange(value){
console.log(value,'====value');
console.log(this.switchValue1,'===uuuu');
},
handleEvent(data){
console.log(data,'data')
},
handleOptions(options){
console.log(options,'options')
},
// copy
handleClickCopy() {
handleClickCopy(){
this.$copy(this.form.input1, {
successMsg: '内容已复制到剪贴板',
errorMsg: '复制失败,请按Ctrl+C手动复制',
@ -750,15 +812,25 @@ export default {
return randomNumber
},
onSwitchChange(value) {
console.log('Switch 状态变化:', this.switchValue, value);
console.log('Switch/ 状态变化:',this.switchValue, value);
// console.log('Switch :',this.form.switchValue2,this.form.switchValue3, value);
},
onSwitchChange1(value) {
//
// console.log(this.tableData2,value,'this.tableData2===');
console.log('Switch/ 状态变化:', value.statu);
},
// ---start
openDialog() {
console.log(this.switchValue1,'switchValue1');
this.dialogVisible = true;
},
openDialog1() {
this.dialogVisible1 = true;
},
openDialog2() {
this.dialogVisible2 = true;
},
//
handleConfirm() {
this.$message.success('点击了确认按钮');
@ -769,11 +841,14 @@ export default {
this.$message.warning('点击了取消按钮');
this.dialogVisible = false;
this.dialogVisible1 = false;
this.dialogVisible2 = false;
},
//
handleClose() {
this.$message.info('弹框已关闭');
this.dialogVisible = false;
this.dialogVisible1 = false;
this.dialogVisible2 = false;
},
dialogVisibleChange(data) {
console.log(data, 'data098908090');
@ -807,6 +882,9 @@ export default {
radioChange(data) {
console.log(data, 'radio--data');
},
selectChangeTest(val){
console.log(val,'select-----选中的',this.form.card,this.form.card1);
},
handleClick(row) {
console.log(row);
},
@ -854,6 +932,7 @@ export default {
item.options = this.optionss;
}
});
console.log(this.formList,'this.formList====');
this.formList = dataList;
},
save() {
@ -885,7 +964,7 @@ export default {
}
</script>
<style scoped>
<style scoped lang="scss">
.demo-container {
padding: 20px;
max-width: 90%;
@ -920,4 +999,117 @@ h2 {
padding-bottom: 10px;
border-bottom: 1px solid #f0f0f0;
}
.elementWrap {
/* width: 100%; */
padding: 30px 40px;
background: #fff;
.ele-item {
display: flex;
align-items: center;
justify-content: flex-start;
margin: 20px 0 30px;
label {
font-size: 16px;
font-weight: bold;
width: 100px;
margin-right: 10px;
text-align: left;
}
}
}
// start
// input drop使
.combo-formItem {
::v-deep {
.form-item-bottom {
position: relative;
}
.select-trigger {
background: #F6F7FA;
border-color: transparent;
}
.is-open .select-trigger {
border-color: #006AFF;
}
.el-input__inner {
border-radius: 2px 0 0 2px;
}
}
.self-drop-wrap {
position: absolute;
z-index: 1;
width: 100%;
}
.appendDrop {
height: 38px;
align-items: center;
border-radius: 0 2px 2px 0;
border: 1px solid #DFE2E6;
border-left-color: transparent;
justify-content: center;
box-sizing: border-box;
padding: 0 30px 0 12px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
&:hover {
border: 1px solid #006AFF;
}
}
}
// end
.ScaleBox {
width: 1000px;
background-size: 100% 100%;
-ms-transition: 0.3s;
transition: 0.3s;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
margin: 0 auto;
}
.cardfooter {
width: 100%;
bottom: 20px;
right: 30px;
text-align: right;
justify-content: center;
}
.btn1 {
cursor: pointer;
font-weight: bold;
width: 114px;
height: 40px;
/* 自动布局 */
display: flex;
align-items: center;
padding: 11px 12px;
box-sizing: border-box;
color: #FFFFFF;
border-radius: 4px;
transition: all .3s;
background: linear-gradient(290deg, #FF4143 4%, #FF768B 92%);
&:hover {
opacity: 0.7;
background: linear-gradient(290deg, #FF4143 4%, #FF768B 92%);
}
}
.btns{
display: flex;
justify-content: flex-end;
align-items: center;
}
</style>

106
packages/Breadcrumb/src/index.vue

@ -10,7 +10,7 @@
>
<template v-if="index !== breadcrumbs.length - 1">
<router-link to="/" v-if="item.title == '首页'">
<!-- <SvgIcon1 :iconPath="require(`../../assets/home-bread.svg`)" defaultColor="#8A9099" :size="16" activeColor="#006AFF"/> -->
<!-- <SvgIcon1 :iconPath="require(`../../assets/home-bread.png`)" defaultColor="#8A9099" :size="16" activeColor="#006AFF"/> -->
<img class="home-icon" src="../../assets/home-bread.png" alt="">
</router-link>
<router-link v-else :to="item.path">{{ item.title }}</router-link>
@ -37,67 +37,67 @@ export default {
},
computed: {
breadcrumbs() {
if (this.$route.meta.hideBreadcrumb) return [];
// if (this.$route.meta.hideBreadcrumb) return [];
const crumbs = [
// {
// path:{
// path:'/',
// query:{uid: "2300"},
// params:{}
// },
// title:''
// },
// {
// path:{
// path: "/agent/siteList",
// query:{uid: "2300"},
// params:{}
// },
// title:""
// },
{
path:{
path:'/',
query:{uid: "2300"},
params:{}
},
title:'首页'
},
{
path:{
path: "/agent/siteList",
query:{uid: "2300"},
params:{}
},
title:"站点列表"
},
];
let currentRoute = this.$route;
// let currentRoute = this.$route;
//
while (currentRoute) {
//
// const matchedRoute = this.$router.options.routes.find(
// r => r.name === currentRoute.name
// );
// while (currentRoute) {
// //
// // const matchedRoute = this.$router.options.routes.find(
// // r => r.name === currentRoute.name
// // );
//
const routeWithParams = {
path: currentRoute.path,
query: currentRoute.query,
params: currentRoute.params
};
// //
// const routeWithParams = {
// path: currentRoute.path,
// query: currentRoute.query,
// params: currentRoute.params
// };
crumbs.unshift({
path: routeWithParams,
title: this.getTitle(currentRoute)
});
// crumbs.unshift({
// path: routeWithParams,
// title: this.getTitle(currentRoute)
// });
// meta.breadcrumbParent
if (currentRoute.meta.breadcrumbParent) {
currentRoute = this.$router.options.routes.find(
r => r.name === currentRoute.meta.breadcrumbParent
);
// // meta.breadcrumbParent
// if (currentRoute.meta.breadcrumbParent) {
// currentRoute = this.$router.options.routes.find(
// r => r.name === currentRoute.meta.breadcrumbParent
// );
// $route
if (currentRoute) {
currentRoute = {
...currentRoute,
path: currentRoute.path,
query: this.$route.query, //
params: this.$route.params, //
meta: currentRoute.meta || {}
};
}
} else {
currentRoute = null;
}
}
// // $route
// if (currentRoute) {
// currentRoute = {
// ...currentRoute,
// path: currentRoute.path,
// query: this.$route.query, //
// params: this.$route.params, //
// meta: currentRoute.meta || {}
// };
// }
// } else {
// currentRoute = null;
// }
// }
return crumbs;
},

7
packages/GuipDialog/index.js

@ -0,0 +1,7 @@
import GuipDialog from './src/index.vue'
GuipDialog.install = function(Vue) {
Vue.component(GuipDialog.name || 'GuipDialog', GuipDialog)
}
export default GuipDialog

124
packages/GuipDialog/src/index.vue

@ -0,0 +1,124 @@
<template>
<el-dialog
:visible.sync="dialogShow"
:title="title"
v-bind="$attrs"
append-to-body
:width="width"
:show-close="showCloseButton"
:before-close="handleClose"
:class="type == 'center' ?'center' : 'normal'"
>
<!-- 自定义内容 -->
<slot></slot>
<!-- 底部按钮 -->
<span v-if="showFooterButton" slot="footer" :class="[type == 'center' ? 'dialog-footer-center' : 'dialog-footer-normal', 'flex']" style="justify-content: space-between;">
<GuipButton v-if="showCancelButton" @click="handleCancel" type="ignore" >{{ cancelText }}</GuipButton>
<GuipButton type="primary" @click="handleConfirm">{{ confirmText }}</GuipButton>
</span>
</el-dialog>
</template>
<script>
import GuipButton from '../../GuipButton';
export default {
name: 'GuipDialog',
props: {
type:{
type:String,
default:'normal'
},
//
dialogVisible: {
type: Boolean,
default: false,
},
//
title: {
type: String,
default: '提示',
},
//
width: {
type: String,
default: '599px',
},
//
showCloseButton: {
type: Boolean,
default: true,
},
//
showCancelButton: {
type: Boolean,
default: true,
},
//
showFooterButton: {
type: Boolean,
default: true,
},
//
cancelText: {
type: String,
default: '取消',
},
//
confirmText: {
type: String,
default: '确定',
},
},
components:{
GuipButton
},
computed: {
dialogShow: {
get() {
return this.dialogVisible;
},
set(newVal) {
this.$emit('dialogVisibleChange', newVal);
}
}
},
data() {
return {
// visible
internalVisible: this.visible,
// dialogVisible:false,
};
},
watch: {
// // prop internalVisible
// visible(newVal) {
// this.internalVisible = newVal;
// },
// // internalVisible
// internalVisible(newVal) {
// this.$emit('update:visible', newVal);
// },
},
methods: {
//
handleClose(done) {
this.$emit('close');
this.internalVisible = false; //
if(done){
done();
}
},
//
handleCancel() {
this.$emit('cancel');
this.internalVisible = false; //
},
//
handleConfirm() {
this.$emit('confirm');
this.internalVisible = false; //
},
},
};
</script>

1
packages/assets/drop-selected.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><g><g></g><g><path d="M13.5732,5.315390953125Q13.6985,5.197082953125,13.7668,5.0388329531250005Q13.835,4.880582953125,13.835,4.708251953125Q13.835,4.626011653125,13.819,4.545351953125Q13.8029,4.464691953125,13.7714,4.388710953125Q13.74,4.3127309531249995,13.6943,4.244350953125Q13.6486,4.175970953125,13.5904,4.117817953125Q13.5323,4.059664953125,13.4639,4.013974953125Q13.3955,3.968284953125,13.3195,3.936812953125Q13.2436,3.905340953125,13.1629,3.889295953125Q13.0822,3.873251953125,13,3.873251953125Q12.90746,3.873251953125,12.81716,3.8935169531250002Q12.72686,3.913781953125,12.64319,3.953328953125Q12.55951,3.992875953125,12.48654,4.049783953125Q12.41356,4.106692953125,12.35481,4.178200953125L7.06803,9.842611953125001L3.542182,7.198221953125Q3.428807,7.101421953125,3.288942,7.049841953125Q3.149076,6.998251953125,3,6.998251953125Q2.9177597,6.998251953125,2.8371,7.014291953124999Q2.75644,7.030341953125,2.680459,7.061811953125Q2.604479,7.093281953125,2.536099,7.138971953125Q2.4677189999999998,7.184661953125,2.409566,7.242821953125Q2.351413,7.300971953125,2.305723,7.369351953124999Q2.260033,7.437731953125001,2.228561,7.513711953125Q2.197089,7.589691953125,2.181044,7.6703519531249995Q2.165,7.7510119531249995,2.165,7.833251953125Q2.165,7.937161953125,2.190469,8.037911953125Q2.215938,8.138651953125,2.265322,8.230081953125Q2.314706,8.321511953125,2.384993,8.398041953125Q2.45528,8.474581953125,2.542182,8.531551953125L6.66667,11.624921953125Q6.72781,11.670781953125001,6.796279999999999,11.704751953125001Q6.864739999999999,11.738721953125001,6.93825,11.759671953125Q7.01175,11.780621953125,7.08784,11.787851953125Q7.16393,11.795081953124999,7.24006,11.788351953125Q7.31619,11.781621953125,7.38983,11.761151953125001Q7.46347,11.740681953125,7.53216,11.707161953125Q7.60084,11.673641953125,7.66229,11.628181953125Q7.72373,11.582721953124999,7.77588,11.526851953125L13.5732,5.315390953125Z" fill-rule="evenodd" fill="#006AFF" fill-opacity="1"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
packages/assets/dropDown_expand.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
packages/assets/dropDown_open.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

BIN
packages/assets/table_empty.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 14 KiB

7
packages/index.js

@ -12,6 +12,7 @@ import SvgIcon from './SvgIcon';
import GuipTable from './GuipTable';
import GuipSwitch from './GuipSwitch';
import GuipTooltip from './GuipToolTip';
import GuipDialog from './GuipDialog';
import 'core-js/stable'
import 'element-ui/lib/theme-chalk/index.css'; // 如果依赖Element
import './styles/index.css'; // 全局引入
@ -32,7 +33,8 @@ const components = [
SvgIcon,
GuipTable,
GuipTooltip,
GuipSwitch
GuipSwitch,
GuipDialog
]
const install = function (Vue) {
@ -59,5 +61,6 @@ export default {
SvgIcon,
GuipTable,
GuipTooltip,
GuipSwitch
GuipSwitch,
GuipDialog
}

2
packages/styles/index.css

@ -4120,7 +4120,7 @@ border-color:#006AFF !important;
}
.el-menu {
border-right: solid 1px #e6e6e6;
border: none;
list-style: none;
position: relative;
margin: 0;

Loading…
Cancel
Save