| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <div class="zSelect">
- <div>
- <div class="checkbox">
- <van-checkbox-group v-model="zSelectValuec" @change="checkboxclick">
- <van-checkbox :name="item.collectionOptionId+''" v-for="(item,index) in zCheckboxcolumns" :key="index"
- shape="square">{{ item.collectionOption }}
- </van-checkbox>
- </van-checkbox-group>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "zSelect",
- props: {
- zCheckboxcolumns: [],
- checkboxval: "",
- textc: "",
- rules: false,
- answerType: "",
- collectionType: "",
- childindex:"",
- childindex1:"",
- childindex2:"",
- childindex4:"",
- childindex3:"",
- level:""
- },
- data() {
- return {
- zSelect: false,
- zSelectValuec: ""
- }
- },
- created() {
- this.checkboxvalFn()
- },
- methods: {
- checkboxvalFn() {
- if (this.checkboxval == "" || this.checkboxval == undefined) {
- this.zSelectValuec = []
- } else {
- this.zSelectValuec = this.checkboxval.split(",")
- }
- },
- checkboxclick(value) {
- var typeval = []
- var index=""
- for (let k = 0; k < this.zCheckboxcolumns.length; k++) {
- for (let kk = 0; kk < value.length; kk++) {
- if (this.zCheckboxcolumns[k].collectionOptionId == value[kk]) {
- typeval.push(this.zCheckboxcolumns[k])
- }
- }
- }
- let datalist = {
- type: this.textc,
- answerType: this.answerType,
- collectionType: this.collectionType,
- childindex:this.childindex,
- childindex1:this.childindex1,
- childindex2:this.childindex2,
- childindex3:this.childindex3,
- childindex4:this.childindex4,
- level:this.level,
- value: typeval
- }
- this.zSelectValuec = value
- this.$emit('zSelectVal', datalist)
- this.zSelect = false
- }
- }
- }
- </script>
- <style scoped>
- .van-f-red {
- color: red;
- width: 4px;
- display: inline-block
- }
- .zSelect .z-cell {
- padding: 10px 16px 0 16px;
- font-size: 16px;
- }
- /*.checkbox{padding: 10px 16px 0 16px;background-color: white;}*/
- .checkbox .van-checkbox {
- padding-bottom: 10px
- }
- </style>
- <style>
- .checkbox .van-checkbox__icon .van-icon {
- border: 1px solid #333 !important;
- }
- .checkbox .van-checkbox__icon--checked .van-icon {
- border: 1px solid #1989fa !important;
- color: #1989fa;
- background-color: #fff;
- }
- </style>
|