Merge branch 'master' of https://gitee.com/geek-xd/geek-uniapp-vue3-uview-plus-uchart
This commit is contained in:
commit
4be484d27a
@ -48,6 +48,13 @@ RuoYi-Vue 与 RuoYi-App 是基于 SpringBoot2+Vue2 打造的企业级开发框
|
||||
|
||||
**注意:**node 版本需要 16+
|
||||
|
||||
## 迁移到Hbuilder(不依赖Hbuilder的项目不需要迁移)
|
||||
|
||||
1. src路径作为项目根路径
|
||||
2. 将index.html、package.json、vite.config.js、tsconfig.json粘贴到src目录下
|
||||
3. 在src目录下运行npm install
|
||||
|
||||
|
||||
## 安装
|
||||
|
||||
一下三种方式均可,感觉速度 pnpm > yarn > cnpm > npm
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* http://ext.dcloud.net.cn/plugin?id=271
|
||||
*
|
||||
-->
|
||||
<template>
|
||||
<template>
|
||||
<view class="chartsview" :id="'ChartBoxId'+cid">
|
||||
<view v-if="mixinDatacomLoading">
|
||||
<!-- 自定义加载状态,请改这里 -->
|
||||
@ -1251,13 +1251,13 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
rootdom = {top:0,left:0}
|
||||
// #ifdef H5
|
||||
let dm = document.querySelectorAll('uni-main')[0]
|
||||
if(dm === undefined){
|
||||
dm = document.querySelectorAll('uni-page-wrapper')[0]
|
||||
}
|
||||
rootdom = {top:dm.offsetTop,left:dm.offsetLeft}
|
||||
// #endif
|
||||
if(dm !== undefined){
|
||||
rootdom = {top:dm.offsetTop,left:dm.offsetLeft}
|
||||
}
|
||||
setTimeout(()=>{
|
||||
if(this.rid === null){
|
||||
this.$ownerInstance && this.$ownerInstance.callMethod('getRenderType')
|
||||
@ -1305,14 +1305,10 @@ export default {
|
||||
this.newEChart()
|
||||
}else{
|
||||
const script = document.createElement('script')
|
||||
// #ifdef APP-VUE
|
||||
script.src = './uni_modules/qiun-data-charts/static/app-plus/echarts.min.js'
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
const rooturl = window.location.origin
|
||||
const directory = instance.getDataset().directory
|
||||
script.src = rooturl + directory + 'uni_modules/qiun-data-charts/static/h5/echarts.min.js'
|
||||
// #endif
|
||||
script.onload = this.newEChart
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
|
||||
@ -1,14 +1,24 @@
|
||||
// #ifdef APP-VUE || H5
|
||||
/**
|
||||
* v-copyText 复制文本内容
|
||||
* Copyright (c) 2022 ruoyi
|
||||
* v-copyText="要复制的文本内容"
|
||||
* v-copyText:callback="复制成功后的回调函数"
|
||||
* 点击被标注的元素即可复制文本内容
|
||||
*/
|
||||
|
||||
export default {
|
||||
beforeMount(el, { value, arg }) {
|
||||
if (arg === "callback") {
|
||||
el.$copyCallback = value;
|
||||
import type { Directive, DirectiveBinding } from "vue";
|
||||
interface ElType extends HTMLElement {
|
||||
$copyValue: string;
|
||||
$copyCallback: Function;
|
||||
$destroyCopy:Function;
|
||||
}
|
||||
const vCopyText:Directive = {
|
||||
beforeMount(el:ElType , binding:DirectiveBinding) {
|
||||
if (binding.arg === "callback") {
|
||||
el.$copyCallback = binding.value;
|
||||
} else {
|
||||
el.$copyValue = value;
|
||||
el.$copyValue = binding.value;
|
||||
const handler = () => {
|
||||
copyTextToClipboard(el.$copyValue);
|
||||
if (el.$copyCallback) {
|
||||
@ -20,10 +30,11 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
export default vCopyText;
|
||||
|
||||
function copyTextToClipboard(input, { target = document.body } = {}) {
|
||||
function copyTextToClipboard(input:string, { target = document.body } = {}) {
|
||||
const element = document.createElement('textarea');
|
||||
const previouslyFocusedElement = document.activeElement;
|
||||
const previouslyFocusedElement = document.activeElement as HTMLElement;
|
||||
|
||||
element.value = input;
|
||||
|
||||
@ -36,6 +47,7 @@ function copyTextToClipboard(input, { target = document.body } = {}) {
|
||||
element.style.fontSize = '12pt'; // Prevent zooming on iOS
|
||||
|
||||
const selection = document.getSelection();
|
||||
if(!selection)return
|
||||
const originalRange = selection.rangeCount > 0 && selection.getRangeAt(0);
|
||||
|
||||
target.append(element);
|
||||
@ -64,3 +76,4 @@ function copyTextToClipboard(input, { target = document.body } = {}) {
|
||||
|
||||
return isSuccess;
|
||||
}
|
||||
// #endif
|
||||
7
src/directive/common/focus.ts
Normal file
7
src/directive/common/focus.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type { Directive } from "vue";
|
||||
const vFocus: Directive = {
|
||||
mounted: (el) => el.focus()
|
||||
}
|
||||
export default vFocus
|
||||
|
||||
|
||||
50
src/directive/common/full.ts
Normal file
50
src/directive/common/full.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import type { Directive } from "vue";
|
||||
interface ElType extends HTMLElement {
|
||||
$oldStyle: CSSStyleDeclaration;
|
||||
$fullStyle: CSSStyleDeclaration;
|
||||
}
|
||||
const vFull: Directive = {
|
||||
mounted: (el: ElType, binding) => {
|
||||
el.$oldStyle = { ...el.style }
|
||||
if (binding.arg === 'screen') {
|
||||
el.$fullStyle = {
|
||||
...el.style,
|
||||
left: '0',
|
||||
top: '0',
|
||||
zIndex: '8',
|
||||
position: 'fixed',
|
||||
height: '100vh',
|
||||
width: '100vw',
|
||||
}
|
||||
} else {
|
||||
el.$fullStyle = {
|
||||
...el.style,
|
||||
left: '0',
|
||||
top: '0',
|
||||
zIndex: '8',
|
||||
position: 'absolute',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
updated: (el: ElType, binding) => {
|
||||
function setStyle(el: CSSStyleDeclaration, style: CSSStyleDeclaration) {
|
||||
el.position = style.position
|
||||
el.left = style.left
|
||||
el.top = style.top
|
||||
el.zIndex = style.zIndex
|
||||
el.height = style.height
|
||||
el.width = style.width
|
||||
}
|
||||
if (binding.value) {
|
||||
setStyle(el.style, el.$fullStyle)
|
||||
} else {
|
||||
setStyle(el.style, el.$oldStyle)
|
||||
}
|
||||
}
|
||||
}
|
||||
export default vFull
|
||||
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
import hasRole from './permission/hasRole'
|
||||
import hasPermi from './permission/hasPermi'
|
||||
import copyText from './common/copyText'
|
||||
|
||||
export default function directive(app){
|
||||
app.directive('hasRole', hasRole)
|
||||
app.directive('hasPermi', hasPermi)
|
||||
app.directive('copyText', copyText)
|
||||
}
|
||||
18
src/directive/index.ts
Normal file
18
src/directive/index.ts
Normal file
@ -0,0 +1,18 @@
|
||||
// #ifdef APP-VUE || H5
|
||||
import copyText from './common/copyText'
|
||||
// #endif
|
||||
import hasRole from './permission/hasRole'
|
||||
import hasPermi from './permission/hasPermi'
|
||||
import focus from './common/focus'
|
||||
import full from './common/full'
|
||||
import { App } from 'vue'
|
||||
|
||||
export default function directive(app: App) {
|
||||
// #ifdef APP-VUE || H5
|
||||
app.directive('copyText', copyText)
|
||||
// #endif
|
||||
app.directive('hasRole', hasRole)
|
||||
app.directive('hasPermi', hasPermi)
|
||||
app.directive('focus', focus)
|
||||
app.directive('full', full)
|
||||
}
|
||||
@ -1,11 +1,12 @@
|
||||
/**
|
||||
* v-hasPermi 操作权限处理
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
|
||||
/**
|
||||
* v-hasPermi 操作权限处理
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
export default {
|
||||
import type { Directive } from "vue";
|
||||
const vHasPermi: Directive = {
|
||||
mounted(el, binding, vnode) {
|
||||
const { value } = binding
|
||||
const all_permission = "*:*:*";
|
||||
@ -26,3 +27,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
export default vHasPermi
|
||||
@ -1,11 +1,11 @@
|
||||
/**
|
||||
* v-hasRole 角色权限处理
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
/**
|
||||
* v-hasRole 角色权限处理
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
|
||||
export default {
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import type { Directive } from "vue";
|
||||
const vHasRole: Directive = {
|
||||
mounted(el, binding, vnode) {
|
||||
const { value } = binding
|
||||
const super_admin = "admin";
|
||||
@ -26,3 +26,5 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default vHasRole;
|
||||
Loading…
Reference in New Issue
Block a user