vant 的 Cascader 级联选择 组建css样式错乱问题修复


- /*级联控件 start*/
-
- .cplvfx .van-popup {
- position: fixed;
- max-height: 100%;
- overflow-y: auto;
- background-color: #fff;
- -webkit-transition: -webkit-transform 0.3s;
- transition: -webkit-transform 0.3s;
- transition: transform 0.3s;
- transition: transform 0.3s, -webkit-transform 0.3s;
- -webkit-overflow-scrolling: touch;
- }
- .cplvfx .van-popup--center {
- top: 50%;
- left: 50%;
- -webkit-transform: translate3d(-50%, -50%, 0);
- transform: translate3d(-50%, -50%, 0);
- }
- .cplvfx .van-popup--center.van-popup--round {
- border-radius: 16px;
- }
- .cplvfx .van-popup--top {
- top: 0;
- left: 0;
- width: 100%;
- }
- .cplvfx .van-popup--top.van-popup--round {
- border-radius: 0 0 16px 16px;
- }
- .cplvfx .van-popup--right {
- top: 50%;
- right: 0;
- -webkit-transform: translate3d(0, -50%, 0);
- transform: translate3d(0, -50%, 0);
- }
- .cplvfx .van-popup--right.van-popup--round {
- border-radius: 16px 0 0 16px;
- }
- .cplvfx .van-popup--bottom {
- bottom: 0;
- left: 0;
- width: 100%;
- }
- .cplvfx .van-popup--bottom.van-popup--round {
- border-radius: 16px 16px 0 0;
- }
- .cplvfx .van-popup--left {
- top: 50%;
- left: 0;
- -webkit-transform: translate3d(0, -50%, 0);
- transform: translate3d(0, -50%, 0);
- }
- .cplvfx .van-popup--left.van-popup--round {
- border-radius: 0 16px 16px 0;
- }
- .cplvfx .van-popup--safe-area-inset-bottom {
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- }
- .cplvfx .van-popup-slide-top-enter-active,
- .cplvfx .van-popup-slide-left-enter-active,
- .cplvfx .van-popup-slide-right-enter-active,
- .cplvfx .van-popup-slide-bottom-enter-active {
- -webkit-transition-timing-function: ease-out;
- transition-timing-function: ease-out;
- }
- .cplvfx .van-popup-slide-top-leave-active,
- .cplvfx .van-popup-slide-left-leave-active,
- .cplvfx .van-popup-slide-right-leave-active,
- .cplvfx .van-popup-slide-bottom-leave-active {
- -webkit-transition-timing-function: ease-in;
- transition-timing-function: ease-in;
- }
- .cplvfx .van-popup-slide-top-enter,
- .cplvfx .van-popup-slide-top-leave-active {
- -webkit-transform: translate3d(0, -100%, 0);
- transform: translate3d(0, -100%, 0);
- }
- .cplvfx .van-popup-slide-right-enter,
- .cplvfx .van-popup-slide-right-leave-active {
- -webkit-transform: translate3d(100%, -50%, 0);
- transform: translate3d(100%, -50%, 0);
- }
- .cplvfx .van-popup-slide-bottom-enter,
- .cplvfx .van-popup-slide-bottom-leave-active {
- -webkit-transform: translate3d(0, 100%, 0);
- transform: translate3d(0, 100%, 0);
- }
- .cplvfx .van-popup-slide-left-enter,
- .cplvfx .van-popup-slide-left-leave-active {
- -webkit-transform: translate3d(-100%, -50%, 0);
- transform: translate3d(-100%, -50%, 0);
- }
- .cplvfx .van-popup__close-icon {
- position: absolute;
- z-index: 1;
- color: #c8c9cc;
- font-size: 22px;
- cursor: pointer;
- }
- .cplvfx .van-popup__close-icon:active {
- color: #969799;
- }
- .cplvfx .van-popup__close-icon--top-left {
- top: 16px;
- left: 16px;
- }
- .cplvfx .van-popup__close-icon--top-right {
- top: 16px;
- right: 16px;
- }
- .cplvfx .van-popup__close-icon--bottom-left {
- bottom: 16px;
- left: 16px;
- }
- .cplvfx .van-popup__close-icon--bottom-right {
- right: 16px;
- bottom: 16px;
- }
-
- .cplvfx .van-calendar__popup.van-popup--top,
- .cplvfx .van-calendar__popup.van-popup--bottom {
- height: 80%;
- }
- .cplvfx .van-calendar__popup.van-popup--left,
- .cplvfx .van-calendar__popup.van-popup--right {
- height: 100%;
- }
- .cplvfx .van-calendar__popup .van-popup__close-icon {
- top: 11px;
- }
-
- .cplvfx .demo-contact-card .van-popup {
- height: 100%;
- background-color: #f7f8fa;
- }
-
-
-
- .cplvfx .van-cascader__header {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- -webkit-box-pack: justify;
- -webkit-justify-content: space-between;
- justify-content: space-between;
- height: 48px;
- padding: 0 16px;
- }
- .cplvfx .van-cascader__title {
- font-weight: 500;
- font-size: 16px;
- line-height: 20px;
- }
- .cplvfx .van-cascader__close-icon {
- color: #c8c9cc;
- font-size: 22px;
- }
- .cplvfx .van-cascader__close-icon:active {
- color: #969799;
- }
- .cplvfx .van-cascader__tabs .van-tab {
- -webkit-box-flex: 0;
- -webkit-flex: none;
- flex: none;
- padding: 0 10px;
- }
- .cplvfx .van-cascader__tabs.van-tabs--line .van-tabs__wrap {
- height: 48px;
- }
- .cplvfx .van-cascader__tabs .van-tabs__nav--complete {
- padding-right: 6px;
- padding-left: 6px;
- }
- .cplvfx .van-cascader__tab {
- color: #323233;
- font-weight: 500;
- }
- .cplvfx .van-cascader__tab--unselected {
- color: #969799;
- font-weight: normal;
- }
- .cplvfx .van-cascader__option {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- -webkit-box-pack: justify;
- -webkit-justify-content: space-between;
- justify-content: space-between;
- padding: 10px 16px;
- font-size: 14px;
- line-height: 20px;
- }
- .cplvfx .van-cascader__option:active {
- background-color: #f2f3f5;
- }
- .cplvfx .van-cascader__option--selected {
- color: #ee0a24;
- font-weight: 500;
- }
- .cplvfx .van-cascader__selected-icon {
- font-size: 18px;
- }
- .cplvfx .van-cascader__options {
- box-sizing: border-box;
- height: 384px;
- padding-top: 6px;
- overflow-y: auto;
- -webkit-overflow-scrolling: touch;
- }
- /*级联控件 end*/
- <div class="cplvfx">
- <van-field
- v-model="AddVal"
- is-link
- readonly
- placeholder="请选择活动地区"
- @click="SelectAddStatus = true"
- />
-
- <van-popup v-model="SelectAddStatus" round position="bottom">
- <van-cascader
- v-model="SelectAddVal"
- title="请选择所在地区"
- :options="AreaData"
- active-color="#17BF8C"
- @close="SelectAddStatus = false"
- @change="AddSelectChange"
- @finish="AddSelectFinish"
- />
- </van-popup>
- </div>
- import { Popup } from 'vant';
- import { Cascader } from 'vant';
- import { Field } from 'vant';
-
-
- Vue.use(Popup);
- Vue.use(Cascader);
- Vue.use(Field);
- export default {
- data(){
- return{
- SelectAddStatus:false,//地址选择状态
- SelectAddVal:'',//地址值
- AddVal:'',//地址值
- }
- },
- created:(){},
- methods:{
- //地址选择发生变化
- AddSelectChange({ value, selectedOptions, tabIndex }){
- console.log('地址选择发生变化');
- console.log(value);
- console.log(selectedOptions);
- console.log(tabIndex);
- },
- //地址选择完成
- AddSelectFinish({ value, selectedOptions, tabIndex }){
- console.log('地址选择完成');
- console.log(value);
- console.log(selectedOptions);
- console.log(tabIndex);
- this.SelectAddStatus = false;
- this.AddVal = selectedOptions.map((option) => option.text).join('/');
- console.log('this.SelectAddVal===');
- console.log(this.SelectAddVal);
- console.log('this.AddVal===');
- console.log(this.AddVal );
- }
-
- },
- }
vue 页面的css样式代码多,怎么把css样式代码做成独立的文件,然后引用进来;以及style的scoped标签介绍以及scoped穿透介绍