computed: {
filteredProducts() {
return this.products
.filter((p) => p.name.toLowerCase().includes(this.nameFilter.toLowerCase()))
.map((p) => {
p.summ = p.price * p.count * (1 - p.discount / 100);
return p;
});
},
totalSumm() {
return this.filteredProducts.reduce((acc, p) => acc + p.summ, 0);
},
}.
<template>
<div class="column-s max-width maib-centr-column pannel-list-time">
<span
v-for="(TimeItem, index) in ListsTime"
:key="index"
:class="{'list-time-item': BookedTime.includes(TimeItem)}">
{{ TimeItem }}:00
</span>
</div>
</template>
<script>
export default {
data() {
return {
ListsTime: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
BookedTime: [11, 12, 15, 16, 17, 18, 21, 22, 23],
}
},
}
</script>
<style>
.list-time-item {
background-color: #E5E5E5;
}
</style>
const json = '{"test":{"a":1,"b":false,"c":"string"},"status":"ok"}';
const prettyJson = JSON.stringify(JSON.parse(json), null, 2);
console.log(prettyJson);
// '{
// "test": {
// "a": 1,
// "b": false,
// "c": "string"
// },
// "status": "ok"
// }'
white-space: pre
и, возможно, моноширинный шрифт. function foo (global, factory) {
if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = factory();
return;
}
if (typeof define === 'function' && define.amd) {
define(factory);
return;
}
global.Vue = factory();
}
foo(this, finction() { ... });