随笔分类 -  Vue

关于学习中用到的Vue知识
摘要:原生放在 mounted 添加正常: document.getElementById('real_center_box').addEventListener('scroll', this.get_scrollTop) 移除,放在 beforeDestroy 或者 destroyed 中,移除时会报错 阅读全文
posted @ 2021-08-08 10:45 yw3692582 阅读(2293) 评论(0) 推荐(0)
摘要:// 语音播放 const synth = window.speechSynthesis const message = new SpeechSynthesisUtterance() function voice_playback(text) { message.text = text messag 阅读全文
posted @ 2021-08-07 18:00 yw3692582 阅读(207) 评论(0) 推荐(0)
摘要:// 文件结构如下, 父容器高度固定,内容超出时出现滚动条,现在需要获取滚动条的位置 <div id="center" style="height: 500px;overflow-y: auto;"> <div></div> </div> script: var center_scrollTop = 阅读全文
posted @ 2021-08-06 13:53 yw3692582 阅读(2961) 评论(0) 推荐(0)
摘要:1、在index.html中引入animate.css 2、使用 transition 标签包裹需要显示/隐藏的内容,通过 v-if 或者 v-show 来控制显示/隐藏,vue官网关于它的介绍:https://cn.vuejs.org/v2/guide/transitions.html 3、重点: 阅读全文
posted @ 2021-08-04 19:26 yw3692582 阅读(1279) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-07-28 09:00 yw3692582 阅读(102) 评论(0) 推荐(0)
摘要:虽然不是c++的,但是代码一样,直接写进去 参考链接:https://ask.csdn.net/questions/1028768 参考链接:https://blog.csdn.net/weixin_45890564/article/details/107542796 阅读全文
posted @ 2021-07-09 11:18 yw3692582 阅读(443) 评论(0) 推荐(0)
摘要:下载地址 vue.js: https://cdn.jsdelivr.net/npm/vue/dist/vue.js element.js: https://unpkg.com/element-ui@2.4.11/lib/index.js element.css: https://unpkg.com/ 阅读全文
posted @ 2021-07-07 18:51 yw3692582 阅读(2884) 评论(0) 推荐(0)
摘要:在 main.js 中引入 在页面中使用: 文件下载地址:https://files.cnblogs.com/files/lyt520/Button.7z 阅读全文
posted @ 2021-07-07 12:56 yw3692582 阅读(344) 评论(0) 推荐(0)
摘要:一、父组件调用子组件中的函数和数据 父组件中引入子组件 center-box: 首先给子组件加上 ref 属性 ‘center_box’ 1、调用子组件的函数: this.$refs['center_box'].test() 2、调用子组件中 data 的值:this.$refs['center_b 阅读全文
posted @ 2021-07-01 11:04 yw3692582 阅读(56) 评论(0) 推荐(0)
摘要:let wsurl = 'ws://82.157.123.54:9010/ajaxchattest' let ws = null let weboscket_callback = null //获取 websocket 推送的数据 let websocketonmessage = e => { re 阅读全文
posted @ 2021-06-23 11:29 yw3692582 阅读(4552) 评论(0) 推荐(0)
摘要:// store.js import Vue from "vue"; import Vuex from "vuex"; Vue.use(Vuex); const moduleA = { namespaced: true, state: () => ({ name: "moduleA", }), mu 阅读全文
posted @ 2021-06-02 09:20 yw3692582 阅读(197) 评论(0) 推荐(0)
摘要:首先封装 axios.js: // 引入 axios 和 qs(qs选择性引入) import axios from 'axios' import qs from 'qs' // 请求拦截:可以在header中统一添加token axios.interceptors.request.use( con 阅读全文
posted @ 2021-05-25 12:49 yw3692582 阅读(215) 评论(0) 推荐(0)
摘要:在组件中添加 name 属性: 在router-view(v-if="isRouterAlive" 不用写,我是出于业务需要才加的): 注意:如果不用 include,将默认所有通过 router-view 的渲染的页面都被缓存,而使用 include 则代表 name 属性相匹配的组件被缓存。 阅读全文
posted @ 2021-05-21 09:02 yw3692582 阅读(224) 评论(0) 推荐(0)
摘要:子组件: <template> <div> <!-- 树结构 --> <el-tree :data="treeData" @node-click="handleNodeClick" :default-expand-all="true" :props="defaultProps" > </el-tre 阅读全文
posted @ 2021-05-20 11:21 yw3692582 阅读(291) 评论(0) 推荐(0)
摘要:store.jsimport Vue from 'vue' import axios from 'axios' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { userData: JSON.p 阅读全文
posted @ 2021-05-13 12:46 yw3692582 阅读(54) 评论(0) 推荐(0)
摘要:1、element-ui的按需引入 npm i element-ui -Snpm install babel-plugin-component -Dvue-cli2.x版本修改.babelrc文件(在后面统一贴代码)2、vant的按需引入 npm i vant -S npm i babel-plug 阅读全文
posted @ 2021-05-12 11:20 yw3692582 阅读(827) 评论(0) 推荐(0)
摘要:<template> <div class="hello"> <EncapTable ref="items" :Data="Data"></EncapTable> </div> </template> <script> import EncapTable from "./EncapTable"; e 阅读全文
posted @ 2021-04-30 10:59 yw3692582 阅读(2890) 评论(0) 推荐(0)
摘要:<template> <div> <!-- 基于el-table二次封装的一个table组件,功能包括:搜索、编辑、删除、分页 --> <el-table :data=" getSearchInfo.slice( (currpage - 1) * Data.pageSize, currpage * 阅读全文
posted @ 2021-04-30 10:57 yw3692582 阅读(411) 评论(0) 推荐(0)
摘要:在config中的index.js的proxyTable添加下面代码 '/api': { target: '请求的地址',//设置你调用的接口域名和端口号 别忘了加http changeOrigin: true, pathRewrite: { '^/api': ''//这里理解成用‘/api’代替t 阅读全文
posted @ 2021-04-19 14:13 yw3692582 阅读(398) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content 阅读全文
posted @ 2021-04-18 20:51 yw3692582 阅读(193) 评论(0) 推荐(0)