• 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. }

     

  • 相关阅读:
    【JavaEE】_前端使用GET请求的queryString向后端传参
    中国电子云数据库 Mesh 项目 DBPack 的实践
    Windows 上下载并提取 Wikipedia
    太速科技-基于Xilinx Kintex-7 FPGA K7 XC7K325T PCIeX8 四路光纤卡
    WinForm,可能是Windows上手最快的图形框架了
    redis 非关系型数据库
    浅谈-动态路由之OSPF的理解
    python 自动化操作必备函数功能
    NTP8928(20W内置DSP双通道D类功放芯片)
    plink的文件格式
  • 原文地址:https://blog.csdn.net/gixome/article/details/126782956