Replies: 1 comment 1 reply
-
/*
* @Author: zouyaoji@https://github.com/zouyaoji
* @Date: 2022-08-23 19:08:12
* @LastEditTime: 2022-08-23 19:21:06
* @LastEditors: zouyaoji
* @Description:
*
* @FilePath: \vue-cesium-demo\src\components\tsx-test\index.tsx
*/
import { defineComponent, ref } from 'vue'
import { VcAnalyses, VcAnalysesRef, VcBtn } from 'vue-cesium'
import { VcDrawingActionInstance } from 'vue-cesium/es/utils/drawing-types'
export default defineComponent({
name: 'Test',
setup(props, ctx) {
const analysisRef = ref<VcAnalysesRef>(null)
const toggle = (drawingActionInstance: VcDrawingActionInstance) => {
analysisRef.value.toggleAction(drawingActionInstance.name)
}
const slots = {
body: (drawingActionInstances: Array<VcDrawingActionInstance>) => {
const child = []
drawingActionInstances.forEach(drawingActionInstance => {
child.push(
<VcBtn
rounded
onClick={() => toggle(drawingActionInstance)}
color={drawingActionInstance.isActive ? 'positive' : 'primary'}>
{drawingActionInstance.name}
</VcBtn>
)
})
return <div class='custom-analysis'>{child}</div>
}
}
return () => [<VcAnalyses v-slots={slots} ref={analysisRef}></VcAnalyses>]
}
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zouyaoji
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
jsx代码
`import { defineComponent, ref } from "vue";
import styles from './ps.module.less'
interface _emit{
(e:'closePs'):void
}
export default defineComponent({
setup(props,{emit}:{emit:_emit}){
const ps=ref()
const editable=ref(true)
const scope=ref()
function clear(){
ps.value.clearAll()
}
function closeEvt(){
emit('closePs')
}
})
**模板语法**
Beta Was this translation helpful? Give feedback.
All reactions