feat: copy link

This commit is contained in:
Fine 2023-02-02 14:32:58 +08:00
parent b9dbc19a51
commit 5635a6ee36

View File

@ -28,7 +28,14 @@ limitations under the License. -->
/> />
</div> </div>
<el-button size="small" type="primary" class="mt-20" @click="getLink">{{ t("generateLink") }}</el-button> <el-button size="small" type="primary" class="mt-20" @click="getLink">{{ t("generateLink") }}</el-button>
<div v-show="widgetLink" class="link mt-10" @click="viewPage">{{ host + widgetLink }}</div> <div v-show="widgetLink" class="link mt-10">
<span @click="viewPage">
{{ host + widgetLink }}
</span>
<span>
<Icon class="cp ml-5" iconName="copy" @click="copyLink" />
</span>
</div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -38,6 +45,7 @@ limitations under the License. -->
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import router from "@/router"; import router from "@/router";
import copy from "@/utils/copy";
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
@ -82,6 +90,9 @@ limitations under the License. -->
const routeUrl = router.resolve({ path: widgetLink.value }); const routeUrl = router.resolve({ path: widgetLink.value });
window.open(routeUrl.href, "_blank"); window.open(routeUrl.href, "_blank");
} }
function copyLink() {
copy(host + widgetLink.value);
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.link { .link {