<div
v-for="item in splitComments"
:key="item.id"
class="comment-item"
>
...
<span
class="comment-text"
v-for="(str, i) in item.textList"
:class="{highlight: i%2}"
>
{{ str }}
</span>
</div>
computed: {
splitComments() {
return this.comments.map(item => ({
...item,
textList: item.text.split(/(@\S+)/)
}))
}
}
tar "6.0.2"
, а не tar "^6.0.2"
.{
"name": "ts",
"version": "1.0.0",
"type": "module",
"main": "index.js",
"module": "index.js",
"license": "MIT",
"dependencies": {
"typescript": "^4.4.4"
},
"devDependencies": {
"@types/node": "^16.11.7"
}
}
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"esModuleInterop": true,
"strict": true
}
}
import cp from "child_process";
console.log(cp);
function findInString(OUTPUT_HTML, before, after) {
let start = OUTPUT_HTML.indexOf(before);
if (start === -1)
return '';
start += before.length;
const end = OUTPUT_HTML.indexOf(',', start);
if (end === -1)
return '';
return OUTPUT_HTML.slice(start, end);
}
const productCost = +findInString(OUTPUT_HTML, '"productCost":', ',');