Browse Source

修改input带单位的样式

develop
zq 1 month ago
parent
commit
120efc6270
  1. 4
      examples/src/App.vue
  2. 104
      packages/Breadcrumb/src/index.vue
  3. 15
      packages/GuipInput/src/index.vue
  4. 1
      packages/index.js
  5. 18
      packages/styles/component.scss

4
examples/src/App.vue

@ -1,7 +1,9 @@
<template>
<div id="app" class="demo-container">
<el-form :model="form" :rules="rules" class="el-row demo-ruleForm" ref="formRef">
<Breadcrumb />
<!-- 当前示例项目未配置路由相关信息--暂时注释 -->
<!-- <Breadcrumb /> -->
<section class="demo-section">
<h2>页面提示框集合</h2>
<PromptText text='这是一个提示框' :type="1" />

104
packages/Breadcrumb/src/index.vue

@ -40,64 +40,64 @@ export default {
// 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;
},

15
packages/GuipInput/src/index.vue

@ -28,7 +28,7 @@
<!-- <el-button slot="append" v-if="hasBtn" type="primary" @click="$emit('enter',value)">搜索</el-button> -->
</el-input>
<!-- 单位 -->
<span class="unit" v-if="unit">{{ unit }}</span>
<span class="guip-input-unit" v-if="unit">{{ unit }}</span>
</el-form-item>
</template>
@ -136,15 +136,4 @@ export default {
},
}
}
</script>
<style lang="scss" scoped>
.unit {
position: absolute;
right: 12px;
/* 根据需要调整位置 */
top: 50%;
transform: translateY(-50%);
pointer-events: none;
/* 防止单位文本影响输入框的点击事件 */
}
</style>
</script>

1
packages/index.js

@ -79,7 +79,6 @@ const install = function (Vue,options={}) {
Vue.component(component.name, component)
})
}
console.log(install,'install===');
export {
GuipButton,

18
packages/styles/component.scss

@ -382,16 +382,14 @@
// 自定义下拉选择框组件 end
// input 组件 start
.guip-input {
.unit {
position: absolute;
right: 12px;
/* 根据需要调整位置 */
top: 50%;
transform: translateY(-50%);
pointer-events: none;
/* 防止单位文本影响输入框的点击事件 */
}
.guip-input-unit {
position: absolute;
right: 12px;
/* 根据需要调整位置 */
top: 50%;
transform: translateY(-50%);
pointer-events: none;
/* 防止单位文本影响输入框的点击事件 */
}
// input 组件 end

Loading…
Cancel
Save