If you have met empty rows in HTML table or have seen this question
Prevent collapse of empty rows in HTML table via CSS
you might know what I am saying. See this image:
Above answers can’t handle strings like " "
. In this case, we still need the help of js. Just like the idea of css,
// prevent empty table rows collapse |
We can write a function like
function falsyToNbsp(value, falsyValues = [null, undefined, "", NaN]) { |
You can use it in vue filters like
import { falsyToNbsp } from "utils"; |
or with other libs.