mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 08:12:49 +08:00
feat: 文字组件添加链接功能
This commit is contained in:
parent
31c63130d6
commit
b8a1fd904b
@ -15,6 +15,7 @@ export const WritingModeObject = {
|
|||||||
|
|
||||||
export const option = {
|
export const option = {
|
||||||
link:'',
|
link:'',
|
||||||
|
linkHead:'http://',
|
||||||
dataset: '我是文本',
|
dataset: '我是文本',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontColor: '#ffffff',
|
fontColor: '#ffffff',
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
<setting-item-box name="链接" :alone="true">
|
<setting-item-box name="链接" :alone="true">
|
||||||
<setting-item>
|
<setting-item>
|
||||||
<n-space><n-input v-model:value="optionData.link" size="small"></n-input><n-button secondary size="small" @click="handleLinkClick" >点击</n-button></n-space>
|
<n-input-group><n-select v-model:value="optionData.linkHead" size="small" :style="{ width: '33%' }" :options="linkHeadOptions" /><n-input v-model:value="optionData.link" size="small"></n-input><n-button :disabled="!optionData.link" secondary size="small" @click="handleLinkClick" >跳转</n-button></n-input-group>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
</collapse-item>
|
</collapse-item>
|
||||||
@ -74,7 +74,6 @@ import {
|
|||||||
SettingItemBox,
|
SettingItemBox,
|
||||||
SettingItem
|
SettingItem
|
||||||
} from '@/components/Pages/ChartItemSetting'
|
} from '@/components/Pages/ChartItemSetting'
|
||||||
import { useMessage } from 'naive-ui'
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
optionData: {
|
optionData: {
|
||||||
type: Object as PropType<typeof option>,
|
type: Object as PropType<typeof option>,
|
||||||
@ -89,13 +88,15 @@ const verticalOptions = [{
|
|||||||
label: WritingModeEnum.VERTICAL,
|
label: WritingModeEnum.VERTICAL,
|
||||||
value: WritingModeObject[WritingModeEnum.VERTICAL]
|
value: WritingModeObject[WritingModeEnum.VERTICAL]
|
||||||
}]
|
}]
|
||||||
const message = useMessage()
|
|
||||||
const handleLinkClick = ()=>{
|
const handleLinkClick = ()=>{
|
||||||
|
window.open(props.optionData.linkHead+props.optionData.link)
|
||||||
if(props.optionData.link){
|
|
||||||
window.open(props.optionData.link)
|
|
||||||
}else{
|
|
||||||
message.info("链接未输入")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
const linkHeadOptions = [{
|
||||||
|
label: 'http://',
|
||||||
|
value: 'http://'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'https://',
|
||||||
|
value: 'https://'
|
||||||
|
}]
|
||||||
</script>
|
</script>
|
||||||
|
@ -38,6 +38,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { w, h } = toRefs(props.chartConfig.attr)
|
const { w, h } = toRefs(props.chartConfig.attr)
|
||||||
const {
|
const {
|
||||||
|
linkHead,
|
||||||
link,
|
link,
|
||||||
dataset,
|
dataset,
|
||||||
fontColor,
|
fontColor,
|
||||||
@ -75,7 +76,7 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: string) => {
|
|||||||
|
|
||||||
//打开链接
|
//打开链接
|
||||||
const click = () => {
|
const click = () => {
|
||||||
window.open(link.value)
|
window.open(linkHead.value+link.value)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user