12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import Vue from 'vue'
- import { useUrlSearchParams } from '@vueuse/core'
- /**
- * Toast 弹窗
- * @param text
- * @param duration
- */
- export function useToast(text, duration = 2000) {
- const thisInstance = Vue.prototype
- return thisInstance.$toast(text, duration)
- }
- /**
- * 获取当前页面 URL source 参数
- */
- export function useURLSource() {
- const params = useUrlSearchParams('history')
- return String(params.source) || ''
- }
- /**
- * 特殊 source 处理
- */
- export function useCustomSpecialSource() {
- let source = useURLSource()
- if (source) {
- const pathname = window.location.pathname
- //结构化数据
- if (pathname == '/front/structed/pc_index.html') {
- source += '_structed'
- }
- //招标文件解读
- if (pathname == '/bid/pc/page/bidfile_landpage') {
- source += '_bidfile'
- }
- //大会员
- if (pathname == '/big/page/index') {
- source += '_member'
- }
- }
- return source
- }
|