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