|
|
@@ -0,0 +1,74 @@
|
|
|
+<template>
|
|
|
+ <div class="fab-btn" style="bottom: {{ bottom }}px;" @click="onTap">
|
|
|
+ <slot>
|
|
|
+ <text style="color: #fff;font-size: 34px;">添加至桌面,天天领签到红包</text>
|
|
|
+ <!-- <text style="font-size: 32px;color: #fff;">+</text>
|
|
|
+ <text style="font-size: 18px;color: #fff;">添加桌面</text> -->
|
|
|
+ </slot>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import router from '@system.router'
|
|
|
+import shortcut from '@system.shortcut'
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ bottom:{
|
|
|
+ type: [String,Number],
|
|
|
+ default: 200
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ hasInstalled:false,//判断是否已有琢磨图标
|
|
|
+ },
|
|
|
+ onTap() {
|
|
|
+ shortcut.install({
|
|
|
+ message:'将【易推小说】添加到桌面,方便下次继续使用。',
|
|
|
+ success: function(e) {
|
|
|
+ console.log('handling success',e)
|
|
|
+ $utils.showToast('添加成功')
|
|
|
+ },
|
|
|
+ fail: function(data, code) {
|
|
|
+ console.log(`handling fail, code = ${code}, errorMsg=${data}`)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // this.$emit('tap')
|
|
|
+ },
|
|
|
+ // 组件
|
|
|
+ onInit(){
|
|
|
+ var that = this
|
|
|
+ shortcut.hasInstalled({
|
|
|
+ success: function(e) {
|
|
|
+ that.hasInstalled = e
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('组件生命周期')
|
|
|
+ },
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+.fab-btn {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 50px;
|
|
|
+ left: 120px;
|
|
|
+ width: 600px;
|
|
|
+ height: 90px;
|
|
|
+ flex-direction: column;
|
|
|
+ background-color: #db3f3f;
|
|
|
+ /* background-color: #399bfc; */
|
|
|
+ /* border-radius: 50%; */
|
|
|
+ /* box-shadow: 0 4px 16px rgba(0,0,0,0.18); */
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ border-radius: 20px;
|
|
|
+ /* z-index: 999; */
|
|
|
+}
|
|
|
+.fab-icon {
|
|
|
+ color: #fff;
|
|
|
+ font-size: 60px;
|
|
|
+ font-weight: bold;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+</style>
|