码农知识堂 - 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. }

     

  • 相关阅读:
    Acwing 暑假每日一题——. 正方形数组的数目
    淘宝API详情接口调用示例
    每日一练 9
    金仓数据库KingbaseES安全指南--6.5. LDAP身份验证
    Oracle报错:ORA-02292: 违反完整约束条件 - 已找到子记录问题解决
    小波神经网络的基本原理,小波神经网络训练过程
    基于单片机的智能饮水机系统
    怎么压缩图片不影响清晰度
    MySQL事务基本操作(方式1)
    Sentinel在Spring Cloud中的流量控制与熔断降级:保障你的微服务稳定运行
  • 原文地址:https://blog.csdn.net/gixome/article/details/126782956
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号