Add CMyToogleList and CMyChipList to views Binary choice number 2, 4, 8... show the Values Selected (join with other table)
This commit is contained in:
5
src/components/CMyChipList/CMyChipList.scss
Normal file
5
src/components/CMyChipList/CMyChipList.scss
Normal file
@@ -0,0 +1,5 @@
|
||||
.clchip{
|
||||
display: flex;
|
||||
//flex: 1;
|
||||
//flex-direction: column;
|
||||
}
|
||||
57
src/components/CMyChipList/CMyChipList.ts
Normal file
57
src/components/CMyChipList/CMyChipList.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Prop, Watch } from 'vue-property-decorator'
|
||||
|
||||
import { tools } from '../../store/Modules/tools'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
|
||||
@Component({
|
||||
name: 'CMyChipList'
|
||||
})
|
||||
|
||||
export default class CMyChipList extends Vue {
|
||||
public $t
|
||||
@Prop({ required: true }) public options: []
|
||||
@Prop({ required: true }) public value
|
||||
@Prop({ required: true, default: '' }) public optlab
|
||||
@Prop({ required: true, default: '' }) public optval
|
||||
@Prop({ required: false, default: '' }) public myclass
|
||||
@Prop({ required: false, default: '' }) public opticon
|
||||
@Prop({ required: false, default: '' }) public optcolor
|
||||
|
||||
public myvalue = ''
|
||||
public myarrvalues = []
|
||||
|
||||
get tools() {
|
||||
return tools
|
||||
}
|
||||
|
||||
public mounted() {
|
||||
this.myarrvalues = []
|
||||
|
||||
console.table(this.options)
|
||||
this.options.forEach((rec, index) => {
|
||||
if (tools.isBitActive(this.value, rec[this.optval])) {
|
||||
const mydata = {
|
||||
label: this.$t(rec[this.optlab]),
|
||||
value: rec[this.optval],
|
||||
valbool: tools.isBitActive(this.value, rec[this.optval]),
|
||||
icon: '',
|
||||
color: tools.getColorByIndexBest(index)
|
||||
}
|
||||
|
||||
if (this.opticon)
|
||||
mydata.icon = rec[this.opticon]
|
||||
if (this.optcolor)
|
||||
mydata.color = rec[this.optcolor]
|
||||
|
||||
this.myarrvalues.push(mydata)
|
||||
}
|
||||
})
|
||||
|
||||
if (this.myarrvalues.length === 0)
|
||||
this.myarrvalues.push({ label: this.$t('otherpages.manage.nessuno'), color: 'gray' })
|
||||
|
||||
console.log('arrvalues=', this.myarrvalues)
|
||||
|
||||
}
|
||||
}
|
||||
19
src/components/CMyChipList/CMyChipList.vue
Normal file
19
src/components/CMyChipList/CMyChipList.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div class="clchip">
|
||||
<div v-for="(rec, index) in myarrvalues">
|
||||
<q-chip dense
|
||||
:color="rec.color"
|
||||
text-color="white"
|
||||
:icon="rec.icon">
|
||||
{{rec.label}}
|
||||
</q-chip>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyChipList.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyChipList.scss';
|
||||
</style>
|
||||
1
src/components/CMyChipList/index.ts
Normal file
1
src/components/CMyChipList/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export {default as CMyChipList} from './CMyChipList.vue'
|
||||
Reference in New Issue
Block a user