Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xgqfrms-GitHub/39afeb64766eccce920fbaeac5f89f23 to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/39afeb64766eccce920fbaeac5f89f23 to your computer and use it in GitHub Desktop.
es6-template-literals-nested & es6-template-literals-condition & es6-template-literals (advanced skill / in deepth)

es6-template-literals (advanced skill / in deepth)

es6-template-literals-nested & es6-template-literals-condition

orderGift += `
    <div class="order-gift cut-line">
        <div class="title">
            <span class="gf-lf">赠豆</span>
            <span class="gf-rt">${parseFloat(dadouoff).toFixed(2)}</span>
        </div>
        ${
            totalReduceMoney
             ? 
             `
             <div class="title">
                <span class="gf-lf">满减</span>
                <span class="gf-rt">${parseFloat(totalReduceMoney).toFixed(2)}</span>
            </div>
            `
            : 
            ``
        } 
        <div class="money">
            <span class="gf-lf">订单金额</span>
            <span class="gf-rt">${parseFloat(sum).toFixed(2)}</span>
        </div>
    </div>
`;