如何使用按钮在新标签页中打开

How to open in new tab using button

<script type="text/html" id="marketSelection">
        <h3 class="choose-store">Choose your store:</h3>
        <div class="text-center">
            <% _.each(suppliers, function (supplier) { %>
            <button class="btn-custom supermarket-item" data-id="<%= supplier.id %>">
                <i></i><%= supplier.name %>
            </button>
            <% }) %>
        </div>

        /*File:src/js/data.js*/
        var cookie_selectedSupermarket = CookieManager.retrieve('supplierId'),
            cookie_selectedPostalCode = CookieManager.retrieve('deliveryareaCode'),
            cookie_q = CookieManager.retrieve('q');
        Data = {
            availabilityList: [JSON_STORE_AVAILABILITY_LIST],
            postalCodes: [JSON_POSTAL_CODES],

            hardCode: {
                selected_supermarket: null,
                selected_postal_code: null,
                q: null
            },
            query: {
                selected_supermarket: Utils.getQueryParameterByName('selected_supermarket'),
                selected_postal_code: Utils.getQueryParameterByName('selected_postal_code'),
                q: Utils.getQueryParameterByName('q')
            },
            cookie: {
                selected_supermarket: cookie_selectedSupermarket ? cookie_selectedSupermarket.value : null,
                selected_postal_code: cookie_selectedPostalCode ? cookie_selectedPostalCode.value : null,
                q: cookie_q ? cookie_q.value : null
            },

            PROTOCOL: 'https://',
            DOMAIN: 'www.test.com.au',
            PATH: '/',
            redirectURI: '/all-products/?supplier=<%= supplierId %><% if (q) { %>&q=<%= q %><% } %>'
        };

我在新标签页中打开按钮时遇到问题。在 HTML - 我知道我们必须添加 _blank 但对于这种情况,解决方案是什么?

谢谢

编辑:添加了更多代码,以便更清楚我想要什么。

您可以使用Javascript

function openTab(url) {
  var win = window.open(url, '_blank');
  win.focus();
}