06 2021 档案

摘要:混入 (mixins): 是分发 Vue 组件中可复用功能的一种方式。mixins混入对象可以包含组件的任意选项。当组件使用mixins混入对象时,所有混入对象的选项将被混入该组件本身的选项。 使用:新建mixins文件夹,再新建info.js //mixins->info.js export de 阅读全文
posted @ 2021-06-23 16:04 chicidol 阅读(108) 评论(0) 推荐(0) 编辑
摘要://vue.config.js const path = require('path') const resolve = (dir) => path.join(__dirname, dir) module.exports = { publicPath: './',//基本路径 assetsDir: 阅读全文
posted @ 2021-06-21 14:47 chicidol 阅读(2522) 评论(0) 推荐(0) 编辑
摘要:nrm是一个npm源管理工具,使用它可以快速切换npm源。 主要可以用于切换npm源为taobao镜像, 由于npm是国外的,安装依赖时速度比较慢,可以切换为taobao镜像,安装速度就会比较快,也不会出错 安装:npm install -g nrm 安装完后使用nrm -V查看版本 如果报错: i 阅读全文
posted @ 2021-06-21 11:11 chicidol 阅读(193) 评论(0) 推荐(0) 编辑
摘要:首先安装axios npm install axios --save 在src下新建utils文件夹 再新建request.js文件 //utils->request.js import axios from 'axios' const requests = axios.create({ baseU 阅读全文
posted @ 2021-06-18 17:17 chicidol 阅读(29) 评论(0) 推荐(0) 编辑
摘要:首先安装vue-router npm install vue-router --save 在src下新建router文件夹 再新建index.js文件 //router->index.js import Vue from 'vue' import VueRouter from 'vue-router 阅读全文
posted @ 2021-06-18 16:27 chicidol 阅读(41) 评论(0) 推荐(0) 编辑
摘要:首先安装vuex npm install vuex --save 在src下新建store文件夹 再新建index.js、state.js、getters.js、mutations.js、mutations-types.js、actions.js文件 //index.js import Vue fr 阅读全文
posted @ 2021-06-18 15:30 chicidol 阅读(19) 评论(0) 推荐(0) 编辑
摘要:安装node.js 查看版本node -v 安装vue3.0版本之前需要先把vue-cli升级到4.0版本, 如果之前安装过vue-cli需要把2.0相关的卸载之后重新安装,npm uni -g vue-cli, 如果没有安装过不需要卸载可以直接安装,npm i -g @vue/cli 查看版本vu 阅读全文
posted @ 2021-06-18 14:52 chicidol 阅读(42) 评论(0) 推荐(0) 编辑
摘要://router.js { path: '/oppo-music', component: () => import('@/views/OppoMusic.vue'), meta: { title: 'OPPO音乐', keepAlive: true, }, name: 'OppoMusic', } 阅读全文
posted @ 2021-06-18 14:29 chicidol 阅读(239) 评论(0) 推荐(0) 编辑
摘要:<audio ref="audio"></audio> import CryptoJS from "crypto-js"; import Hls from 'hls.js'; methods:{ getHls (url) { if (Hls.isSupported()) { var hls = ne 阅读全文
posted @ 2021-06-18 13:56 chicidol 阅读(110) 评论(0) 推荐(0) 编辑
摘要:<div :style="{ color: activeColor, fontSize: fontSize + 'px' }"></div> data () { return { //初始样式 activeColor:'red', fontSize :30, }; }, //改变样式 this.ac 阅读全文
posted @ 2021-06-18 13:44 chicidol 阅读(230) 评论(0) 推荐(0) 编辑
摘要:给设置overflow:hidden的元素设置position:fixed即可解决 阅读全文
posted @ 2021-06-18 13:38 chicidol 阅读(91) 评论(0) 推荐(0) 编辑
摘要:需要使用hls插件 首先安装依赖npm install hls.js --save <audio ref="audio"></audio> import Hls from 'hls.js'; methods: { init(){ if (Hls.isSupported()) { var hls = 阅读全文
posted @ 2021-06-17 16:54 chicidol 阅读(1746) 评论(0) 推荐(0) 编辑
摘要:import CryptoJS from "crypto-js"; import urlencode from "urlencode"; methods:{ async initUser () { try { const url = "/api/info/self"; let _param = { 阅读全文
posted @ 2021-06-15 14:24 chicidol 阅读(100) 评论(0) 推荐(0) 编辑
摘要:methods:{ handleClick(){ //fetch方法:用来快速获取json格式数据 //Promise对象 //url:链接地址 fetch(“url”) // 第一个 then 接受到的是请求头的相关信息 .then(res=>{ console.log(res) //拿到的是一个 阅读全文
posted @ 2021-06-15 13:48 chicidol 阅读(41) 评论(0) 推荐(0) 编辑
摘要:如果使用v-for遍历数据时,想筛选出URL不为空的项并进行渲染 <ul> <li v-for="(item,index) in list" v-if="item.url" :key="index"> {{ item.name }} </li> </ul> 但是v-for和v-if无法同时使用,这时 阅读全文
posted @ 2021-06-15 13:46 chicidol 阅读(198) 评论(0) 推荐(0) 编辑
摘要:首先安装mockjs npm install mockjs --save-dev 创建mock.js //mock.js const Mock = require("mockjs"); // const Random = Mock.Random // Mock.Random 是一个工具类,用于生成各 阅读全文
posted @ 2021-06-09 15:40 chicidol 阅读(1745) 评论(0) 推荐(0) 编辑
摘要:路径必须用require包裹起来才会起作用 阅读全文
posted @ 2021-06-09 15:31 chicidol 阅读(189) 评论(0) 推荐(0) 编辑
摘要:大致思路: 首先调用登录接口获取到token,把token存储在cookie中,保证刷新页面能记住用户登录状态,登录成功后把token添加在每个请求的请求头中,页面中的请求才能顺利请求到结果。在全局钩子router.beforeEach中拦截路由,判断是否已获得token,判断获取到token后,调 阅读全文
posted @ 2021-06-09 15:24 chicidol 阅读(599) 评论(0) 推荐(0) 编辑
摘要:多个开发者同时操作git中的同一个文件,第一个人在commit和push的时候是可以正常提交的,而之后的开发者执行pull,就会报冲突异常conflict。 解决方案: 全部采用当前更改 之后再去git add .; git commit -m ' '; git push -u origin mas 阅读全文
posted @ 2021-06-09 15:19 chicidol 阅读(77) 评论(0) 推荐(0) 编辑