feat: hideSurelyVueTableWatermark

This commit is contained in:
FairyEver 2022-01-11 15:07:29 +08:00
parent cefb806385
commit 5a32519cd7
2 changed files with 16 additions and 9 deletions

View File

@ -14,11 +14,18 @@
// 3. If you choose to use the method in this project to remove the watermark in the online project, you can only bear all the consequences // 3. If you choose to use the method in this project to remove the watermark in the online project, you can only bear all the consequences
// 4. D2Admin (https://github.com/d2-projects/d2-admin) does not use this method to hide watermarks in any production environment // 4. D2Admin (https://github.com/d2-projects/d2-admin) does not use this method to hide watermarks in any production environment
export function hideSurelyTableWatermark () { export function hideSurelyVueTableWatermark () {
if (import.meta.env.PROD) return if (import.meta.env.PROD || location.hostname !== 'localhost') return
if (location.hostname !== 'localhost') return clean(
document.querySelectorAll('div.surely-table > div.surely-table-body > div') 'div.surely-table > div',
.forEach(e => e.innerHTML === 'Powered by Surely Vue' && (e.innerHTML = '')) ['Unlicensed Product', 'Invalid License']
document.querySelectorAll('div.surely-table > div') )
.forEach(e => ['Unlicensed Product', 'Invalid License'].includes(e.innerHTML) && (e.innerHTML = '')) clean(
'div.surely-table > div.surely-table-body > div',
['Powered by Surely Vue']
)
}
function clean (selector, text) {
document.querySelectorAll(selector).forEach(e => text.includes(e.innerHTML) && (e.innerHTML = ''))
} }

View File

@ -10,7 +10,7 @@
<script> <script>
import { defineComponent, ref, onMounted } from 'vue' import { defineComponent, ref, onMounted } from 'vue'
import { hideSurelyTableWatermark } from 'd2/utils/helper/surely-vue.js' import { hideSurelyVueTableWatermark } from 'd2/utils/helper/surely-vue.js'
const columns = [ const columns = [
{ title: 'Full Name', dataIndex: 'name' }, { title: 'Full Name', dataIndex: 'name' },
@ -35,7 +35,7 @@ export default defineComponent({
}) })
} }
onMounted(() => { onMounted(() => {
hideSurelyTableWatermark() hideSurelyVueTableWatermark()
}) })
return { return {
stable, stable,