码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • uniapp 学习笔记二十四 购物车编辑弹窗页面搭建


    uniapp 学习笔记二十四 购物车编辑弹窗页面搭建

    cart.vue

    1. <script>
    2. import {mapState,mapMutations,mapGetters} from 'vuex'
    3. export default {
    4. data() {
    5. return {
    6. show:false
    7. }
    8. },
    9. computed: {
    10. ...mapState({
    11. cartList:state=>state.cart.cartList
    12. }),
    13. ...mapGetters({
    14. allInfo:'cart/allInfo'
    15. })
    16. },
    17. methods:{
    18. ...mapMutations({
    19. handleCheck:'cart/cartCheckMut',
    20. handleAllCheck:'cart/cartAllCheckMut'
    21. })
    22. }
    23. }
    24. script>
    25. <style lang="scss">
    26. page{
    27. padding-bottom: 100upx;
    28. }
    29. .poster{
    30. width: 180upx;
    31. height: 180upx;
    32. background-color: #d8d8d8;
    33. }
    34. .info{
    35. width: 60%;
    36. .edit{
    37. width: 80upx;
    38. height: 80upx;
    39. text-align: center;
    40. line-height: 80upx;
    41. background-color: #e6e6e6;
    42. border-radius: 50%;
    43. }
    44. }
    45. .icon-youxiajiaogouxuan{
    46. width: 50upx;
    47. height: 50upx;
    48. text-align: center;
    49. line-height: 50upx;
    50. background-color: #e6e6e6;
    51. border-radius: 20%;
    52. }
    53. .fixed {
    54. position: fixed;
    55. bottom: 0;
    56. left: 0;
    57. width: 100%;
    58. box-shadow: 0 0 10upx 2upx rgba(0, 0, 0, 0.2);
    59. }
    60. .yellow{
    61. background-color: yellow;
    62. }
    63. .cu-btn.lg{
    64. width: 50%;
    65. }
    66. .cover-cont{
    67. position: absolute;
    68. top: 50%;
    69. left: 0;
    70. width: 690upx;
    71. transform: translateY(-50%);
    72. }
    73. style>

    cart.js

    1. export default {
    2. namespaced:true,
    3. state(){
    4. return {
    5. cartList:[{
    6. id:"10090",
    7. twoId:10089,
    8. name:"拿破仑草莓恋爱",
    9. french:"Napoleon aux fraises",
    10. price:"208.00",
    11. isCheck:false,
    12. img:"/static/logo.png"
    13. },{
    14. id:"10090",
    15. twoId:10089,
    16. name:"拿破仑草莓",
    17. french:"Napoleon aux fraises",
    18. price:"218.00",
    19. tid:11,
    20. tname:'限定',
    21. isCheck:false,
    22. img:"/static/logo.png"
    23. }
    24. ]
    25. }
    26. },
    27. getters:{
    28. allInfo(state){
    29. let allCheck = true
    30. state.cartList.forEach(item=>{
    31. if(!item.isCheck){
    32. allCheck = false
    33. }
    34. })
    35. return {allCheck}
    36. }
    37. },
    38. mutations:{
    39. cartCheckMut(state,idx){ // 单选
    40. state.cartList[idx].isCheck = !state.cartList[idx].isCheck
    41. },
    42. cartAllCheckMut(state,bool){ // 全选 bool 是原本的全选状态
    43. state.cartList.forEach(item=>{
    44. item.isCheck = !bool
    45. })
    46. }
    47. }
    48. }

     

  • 相关阅读:
    【Hive】MapReduce 如何实现 Hive SQL 的基本操作-distinct
    故障电弧探测器的必要性及组网方案 安科瑞 时丽花
    MySQL事务
    Knife4j Spring Boot:在线API文档
    互换性测量与技术——偏差与公差的计算,公差图的绘制,配合与公差等级的选择方法
    ts的文字类型
    HTML小游戏13 —— 仿《神庙逃亡》3D风格跑酷游戏《墓地逃亡》(附完整源码)
    Linux实用指令-指定运行级别、帮助指令
    购物车
    卡尔丹旋转规则
  • 原文地址:https://blog.csdn.net/gixome/article/details/126782956
  • 最新文章
  • 【FHE】我们如何实现同态加密推理(八):SiLU 的密文化——两条路径,和一个 8 字节的开关
    SQLcl 中 c/old/new 替换变量为何失效?先定位再替换
    不让模型写作文,直接从它脑子里读答案:Jev 决策在 .NET 的两条路线
    Halo插件:支持GitHub的图床附件策略
    电视投屏界的“一股清流”!SimpleTVCast 6.0.0-beta 抢先体验:无需TV端App,界面大换血!✨
    华三VXLAN集中式网关实战指南:Spine多活网关 + 双活接入(M-LAG)
    软件更好写之后口碑会更重要
    大 O、大 Omega、大 Theta 的区别,O(n) 复杂度是什么意思
    Java标签跳转:一个鲜为人知但却很实用的小技巧
    多智能体系统论文速读
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号