摘要: 第一步:在store/index.js中 import Vue from 'vue' import Vuex from 'vuex' import cart from './modules/cart'; //在store的文件夹下新建一个modules/cart.js模块 Vue.use(Vuex) 阅读全文
posted @ 2021-06-10 19:17 是娜娜呀~ 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 方法一: 在组件内部事件触发时,通过dispatch传参 methods:{ handleAddCount(){ //第一种 //在组件内部提交数据,以载荷的形式分发 this.$store.dispatch('increment',{ amount:10, }) //increment 是stor 阅读全文
posted @ 2021-06-10 19:16 是娜娜呀~ 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 安装: npm install vuex --save vue add vuex 使用: 在store/index.js中 import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store 阅读全文
posted @ 2021-06-10 19:13 是娜娜呀~ 阅读(37) 评论(0) 推荐(0) 编辑
摘要: //在需要获取的页面引入 import {mapState,mapGetters,mapMutations,mapActions} from "vuex"; mapState的使用方法: export default { computed:{ //第一种写法 count(){ return this 阅读全文
posted @ 2021-06-10 19:09 是娜娜呀~ 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 代码如下: <style type="text/css"> .title{ position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 300px; height: 300px; font-size: 2 阅读全文
posted @ 2021-02-03 10:17 是娜娜呀~ 阅读(346) 评论(0) 推荐(0) 编辑
摘要: 最近在做一个项目的时候遇到一个问题,就是当swiper遇上tab切换时,会出现一系列问题,例如:swiper不能滚动,或者出现点击错乱的情况,猜测原因是点击的时候未清除上一个swiper,解决办法就是使用observeParents、observer; 代码如下: <script language= 阅读全文
posted @ 2021-01-22 19:27 是娜娜呀~ 阅读(511) 评论(0) 推荐(0) 编辑
摘要: 实现效果: 代码如下: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script type="text/javascript" src="https://cdnj 阅读全文
posted @ 2020-12-21 17:15 是娜娜呀~ 阅读(511) 评论(0) 推荐(0) 编辑
摘要: 问题描述:div等块级元素默认宽度为100%,当页面渲染完后其宽度已经固定,这时候如果文字超出其宽度后会出现滚动条,这时超过原宽度的部分背景可能跟div定义的背景色不一样; 解决方式:给最外层div添加样式: min-width: max-content; 解决之后效果如图下所示: 扩展:max-c 阅读全文
posted @ 2020-12-16 18:12 是娜娜呀~ 阅读(788) 评论(0) 推荐(0) 编辑
摘要: 如图所示: 代码: 1 word-break:break-all; //只对英文起作用,以字母作为换行依据 2 word-wrap:break-word; //只对英文起作用,以单词作为换行依据 3 white-space:pre-wrap; //只对中文起作用,强制换行 4 white-space 阅读全文
posted @ 2020-12-16 18:07 是娜娜呀~ 阅读(1615) 评论(0) 推荐(0) 编辑
摘要: 1、要制作一个图标,大小为16*16像素。文件扩展名为ico; 2、在html文件的“”之间添加如下代码: <link href="图片路径" type="image/x-icon" rel="shortcut icon" /> 效果如图所示: 阅读全文
posted @ 2020-12-16 18:03 是娜娜呀~ 阅读(960) 评论(0) 推荐(0) 编辑