选中颜色

This commit is contained in:
luyuan 2020-08-08 16:53:44 +08:00
parent 78d60bd9ac
commit 641cb4a4a2
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
3 changed files with 16 additions and 4 deletions

View File

@ -18,12 +18,19 @@ export default {
xuanzhong:false, xuanzhong:false,
} }
}, },
props:['image','title','price','num','sid'], props:['image','title','price','num','sid','wxuanzhong'],
methods:{ methods:{
xuanzhongs(){ xuanzhongs(){
this.xuanzhong = !this.xuanzhong this.xuanzhong = !this.xuanzhong
this.$emit("xuanzhong") this.$emit("xuanzhong")
} }
},
watch:{
},
created(){
this.xuanzhong = this.wxuanzhong
console.log(this.wxuanzhong)
} }
} }
</script> </script>

View File

@ -3,10 +3,10 @@
<view class="title">我的商品</view> <view class="title">我的商品</view>
<u-checkbox-group> <u-checkbox-group>
<view class="list"> <view class="list">
<shopItem @xuanzhong="xuanzhong" class="items" v-for="(i,j) in list" :key="j" :image="i.goods_image" :title="i.goods_name" :price="i.goods_marketprice" :num="i.goods_salenum" :sid="i.goods_id" ref="shop"></shopItem> <shopItem @xuanzhong="xuanzhong" :wxuanzhong="sele.indexOf(i.goods_id + '') > -1" class="items" v-for="(i,j) in list" :key="j" :image="i.goods_image" :title="i.goods_name" :price="i.goods_marketprice" :num="i.goods_salenum" :sid="i.goods_id" ref="shop"></shopItem>
</view> </view>
</u-checkbox-group> </u-checkbox-group>
<view class="jiaru" @click="jiaru">加入售货袋</view> <view class="jiaru" @click="jiaru" :style="{'background-color': sele.length > 0 ? 'rgba(255, 120, 15, 1' : ''}">加入售货袋</view>
</view> </view>
</template> </template>
<script> <script>
@ -45,6 +45,11 @@ export default {
} }
}, },
onLoad(){ onLoad(){
this.sele = uni.getStorageSync("gouwudai").split(',')
if(this.sele[0] == ""){
this.sele = []
}
console.log(this.sele[0])
this.$u.api.getStoreGoodsList().then((res)=>{ this.$u.api.getStoreGoodsList().then((res)=>{
this.list = res.data.list this.list = res.data.list
}) })

View File

@ -21,7 +21,7 @@
</u-form-item> </u-form-item>
<view class="values"><text>{{20 - form.text.length}}</text>/20</view> <view class="values"><text>{{20 - form.text.length}}</text>/20</view>
<u-form-item label-position="right" > <u-form-item label-position="right" >
<u-input v-model="form.values" placeholder="我的售货袋" @click="navto('selectshop')"/> <u-input :disabled="true" v-model="form.values" placeholder="我的售货袋" @click="navto('selectshop')"/>
<view class="rightes" @click="navto('selectshop')">售货袋</view> <view class="rightes" @click="navto('selectshop')">售货袋</view>
</u-form-item> </u-form-item>
</u-form> </u-form>