Hi Team,
I am going from Page 1 to Page 2 and trying to store a few items in local storage. They seem to transfer on desktop, but not on mobile. Any suggestions on how to speed this up?
The logo change on Page 2 is also painfully slow and looks pretty ugly to have it flash in after everything else. Any ideas there would also be appreciated.
Hi Team,
I am going from Page 1 to Page 2 and trying to store a few items in local storage. They seem to transfer on desktop, but not on mobile. Any suggestions on how to speed this up?
The logo change on Page 2 is also painfully slow and looks pretty ugly to have it flash in after everything else. Any ideas there would also be appreciated.
Page 1 Code:
import {local} from 'wix-storage';
$w.onReady( function () {
$w.onReady( () => {
$w("#dataset1").onReady( () => {
let count = $w("#dataset1").getTotalCount();
} );
} );
$w.onReady( function () {
$w("#button15").onClick( (event) => {
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem();
let couponCode = clickedItemData.couponCode;
let merchant = clickedItemData.merchant;
let nonAffiliateLink = clickedItemData.nonAffiliateLink;
let dealsPage = clickedItemData.dealsPage;
console.log(couponCode)
console.log(merchant)
console.log(nonAffiliateLink)
console.log(dealsPage)
local.setItem('coupon', couponCode);
local.setItem('merchant', merchant);
local.setItem('nonAffiliateLink', nonAffiliateLink);
local.setItem('dealsPage', dealsPage);
} );
} );
} );
Page 2 Code
import {local} from 'wix-storage';
import wixData from 'wix-data';
$w.onReady(function () {
let couponCode = local.getItem('coupon');
let dealsPage = local.getItem('dealsPage')
let nonAffiliateLink = local.getItem('nonAffiliateLink')
let merchant = local.getItem('merchant')
$w("#text15").text = couponCode
$w("#button34").link = dealsPage
$w('#button22').link = nonAffiliateLink
$w('#button22').label = 'SEND ME TO ' + merchant
console.log(couponCode)
console.log(dealsPage)
console.log(nonAffiliateLink)
console.log(merchant)
local.removeItem(couponCode)
wixData.query("BrandLogos")
.eq("merchant", merchant)
.find()
.then((results) => {
if(results.items.length > 0) {
console.log(results.items[0]); //see firstItem below
let logo = results.items[0].logo
console.log('Setting new logo')
$w('#image11').src = logo
} else {
// handle case where no matching items found
}
})
.catch((err) => {
console.log(err);
});
$w('#image11').show();
$w('#text14').show();
$w('#vectorImage1').show();
$w('#text15').show();
$w('#button22').show();
$w('#button34').show();
});
Page 1: couponquery dot com slash mylabbox
Page 2: Hit any Get Code button