1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import Vue from 'vue'
- import store from './store'
- import App from './App'
- Vue.prototype.$store = store
- // import VueClipboard from 'vue-clipboard2'
- // Vue.use(VueClipboard);
- /**
- * 所有测试用数据均存放于根目录json.js
- *
- * css部分使用了App.vue下的全局样式和iconfont图标,有需要图标库的可以留言。
- * 示例使用了uni.scss下的变量, 除变量外已尽量移除特有语法,可直接替换为其他预处理器使用
- */
- const msg = (title, duration=2500, mask=false, icon='none')=>{
- //统一提示方便全局修改
- if(Boolean(title) === false){
- return;
- }
- uni.showToast({
- title,
- duration,
- mask,
- icon
- });
- }
- const prePage = ()=>{
- // 获取当前页面
- let pages = getCurrentPages();
- let prePage = pages[pages.length - 2];
- // #ifdef H5
- return prePage;
- // #endif
- return prePage.$vm;
- }
- var music = null;
- music = uni.createInnerAudioContext(); //创建播放器对象
- music.autoplay = false;
- music.loop = true;
- music.src= "./static/audio/xx.mp3"; //选择播放的音频
- Vue.prototype.ScanAudio = function(e){
- let player = e;
- if (player == true ) {
- music.play(); //执行播放
- console.log('执行播放1', player)
- } else {
- music.pause(); //暂停播放
- console.log('暂停播放')
- }
- }
- var musict = null
- musict = uni.createInnerAudioContext();
- musict.autoplay = false;
- musict.loop = true;
- musict.src= "./static/audio/bg-music.mp3"; //选择播放的音频
- function playMusic(e){
- let player = e;
- if (player == true ) {
- musict.play(); //执行播放
- console.log('执行播放1', player)
- } else {
- musict.pause(); //暂停播放
- console.log('暂停播放')
- }
- }
- musict.onPlay(() => {
- console.log('开始播放');
- store.state.isPlay = true
- });
- Vue.config.productionTip = false
- Vue.prototype.$fire = new Vue();
- Vue.prototype.$store = store;
- Vue.prototype.$api = {msg, prePage,playMusic};
- App.mpType = 'app'
- const app = new Vue({
- ...App
- })
- app.$mount()
|