优化
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<view class='search-view'>
|
||||
<view class='search-input'>
|
||||
<image :src='assetsUrl("ic_search.png")' />
|
||||
<input placeholder='输入名称、款号搜索' />
|
||||
<input placeholder='输入名称、款号搜索' @input='bindInput' />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<image class='goods-image' :src='item.images' />
|
||||
<text class='goods-name'>{{ item.goodsName }}</text>
|
||||
<text class='goods-price'>¥{{ item.price }}</text>
|
||||
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' />
|
||||
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart' />
|
||||
</view>
|
||||
</grid-view>
|
||||
</scroll-view>
|
||||
@@ -22,13 +22,37 @@
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { goPath } from '@/utils';
|
||||
|
||||
import { getGoodsList } from '@/api/goods';
|
||||
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||
import { GoodsBean } from '@/api/goods/types';
|
||||
|
||||
const goodsList = ref<GoodsBean[]>([1, 2, 3, 4, 1, 2, 2, 2]);
|
||||
const shoppingCartStore = useShoppingCartStore();
|
||||
|
||||
const goodsList = ref<GoodsBean[]>([]);
|
||||
|
||||
onLoad((e) => {
|
||||
|
||||
});
|
||||
|
||||
const bindInput = async (e: any) => {
|
||||
const { rows } = await getGoodsList({
|
||||
page: {
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
bean: {
|
||||
keyword: e.detail.value,
|
||||
typeIds: ['1724629185362591745']
|
||||
}
|
||||
}
|
||||
});
|
||||
goodsList.value = rows;
|
||||
};
|
||||
|
||||
const addShoppingCart = (item: GoodsBean) => {
|
||||
shoppingCartStore.save(item);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
@@ -72,13 +96,12 @@ const goodsList = ref<GoodsBean[]>([1, 2, 3, 4, 1, 2, 2, 2]);
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
padding: 10rpx 10rpx;
|
||||
background: #333333;
|
||||
flex: 1;
|
||||
|
||||
.goods-image {
|
||||
border-radius: 10rpx;
|
||||
width: 100%;
|
||||
max-height: 200rpx;
|
||||
max-height: 400rpx;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
|
Reference in New Issue
Block a user