摘要: Vue自定义指令控制按钮权限 1. 定义自定义指令代码 1.1新建 directives.js 文件 import Vue from 'vue' import store from '@/store/index' // 自定义按钮控制指令 Vue.directive('permission', { 阅读全文
posted @ 2022-03-28 14:18 祁腾飞 阅读(601) 评论(0) 推荐(0) 编辑
摘要: Vue项目首屏加载添加Loading效果, 在Vue实例未初始化之前 loading效果展示 初始化完成之后loading效果消失 1. HTML代码 在 app 里面添加以下代码 <div id="app"> <!-- loading --> <div id="loading-mask"> <di 阅读全文
posted @ 2022-03-24 17:47 祁腾飞 阅读(1597) 评论(0) 推荐(0) 编辑
摘要: 官方文档 https://cli.vuejs.org/zh/guide/mode-and-env.html 个人实践 1. 首先在项目根目录创建不同环境的 .env文件 2. 在.env.xxx 文件中添加内容 NODE_ENV = production VUE_APP_API_BASE_URL = 阅读全文
posted @ 2022-03-21 16:10 祁腾飞 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 主应用 1. 引入并注册 import { registerMicroApps, start } from 'qiankun' // 注册微应用 registerMicroApps([ { name: 'thd-psy-web', entry: '/thd-sz-web/child/thd-psy- 阅读全文
posted @ 2022-03-17 10:48 祁腾飞 阅读(1088) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-01-20 11:11 祁腾飞 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 父组件代码 <!-- 父组件代码 --> <template> <div id="nav"> <AboutVue :value="parentValue" @add="onParentClick" /> <br /> <button @click.stop="onParentClick()">父组件 阅读全文
posted @ 2022-01-04 14:27 祁腾飞 阅读(2882) 评论(0) 推荐(0) 编辑
摘要: 效果图 代码: <template> <div class="home"> <div ref="myRef"></div> </div> </template> <script setup> import { ref, onMounted, onBeforeUnmount } from 'vue' 阅读全文
posted @ 2021-12-28 16:38 祁腾飞 阅读(1659) 评论(0) 推荐(1) 编辑
摘要: cli版如果想安装less、scss、ts等编译器,需自己手动npm安装。在HBuilderX的插件管理界面安装无效,那个只作用于HBuilderX创建的项目。(引自官方~) 解决方法 : npm i node-sass@4 sass-loader@7 -D 注意事项 : 注意 node-sass 阅读全文
posted @ 2021-11-09 10:22 祁腾飞 阅读(508) 评论(0) 推荐(0) 编辑
摘要: 方式1 Props 父组件代码 <template> <!-- 父组件 --> <div class="parent"> <Child :num="count" @handle="changeValue" /> <button @click="add">父组件的按钮</button> </div> 阅读全文
posted @ 2021-01-11 20:43 祁腾飞 阅读(14486) 评论(0) 推荐(0) 编辑
摘要: 首先在组件中导入 getCurrentInstance 1 import { 2 defineComponent, 3 reactive, 4 getCurrentInstance // 从此函数的返回值中获取到ctx属性调用$router.push() 5 } from 'vue' 然后在setu 阅读全文
posted @ 2021-01-10 20:26 祁腾飞 阅读(1362) 评论(1) 推荐(0) 编辑