当前位置: 首页 > news >正文

vi设计公司模板seo工作职责

vi设计公司模板,seo工作职责,wordpress单栏简洁,上海政府门户网站的建设文章目录 defineProps普通写法TS写法 defineEmits普通写法TS写法 defineExpose defineProps 和 defineEmits 都是只能在 <script setup> 中使用的编译器宏。他们不需要导入&#xff0c;且会随着 <script setup> 的处理过程一同被编译掉。 defineProps 接收父组件传…

文章目录

  • defineProps
    • 普通写法
    • TS写法
  • defineEmits
    • 普通写法
    • TS写法
  • defineExpose

definePropsdefineEmits 都是只能在 <script setup> 中使用的编译器宏。他们不需要导入,且会随着 <script setup> 的处理过程一同被编译掉。

defineProps

接收父组件传递的参数

父页面
<template><p>父组件</p><child :num="num"></child>
</template>
子页面
<template><p>我是子组件接收的num:{{ num }}</p>
</template><script lang="ts" setup>
let Props = defineProps({num: {type: Number,default: 0,},
})
console.log('Props',Props,Props.num)
</script>

想在子组件中使用参数值需要用变量Props 接收defineProps

使用的时候直接Props.num,在html中直接使用num即可无需加上变量名称。

defineProps两种写法:

普通写法

let Props = defineProps({num: {type: Number,default: 0,},
})

TS写法

defineProps<{title:string,data:number[]
}>()

TS 特有的默认值方式:withDefaults是个函数也是无须引入开箱即用接受一个props函数第二个参数是一个对象设置默认值。

withDefaults(defineProps<{title:string,data:number[]
}>(),{title:'张三',data()=>[1,2,3]
})

defineEmits

子组件向父组件派发数据

父页面<template><p>父组件</p><child :num="num" @fn="addNum" @fn2="paramsNum"></child>
</template><script lang="ts" setup>
========= vue2需要使用component挂载组件,vue3 不需要! 引入就直接可以使用!!!=========
import Child from './child.vue'
import { ref } from 'vue'let num = ref(20)========= 子传父回调 =========
let addNum = () => {num.value++
}========= 子传父带参数 =========
let paramsNum = (id: any) => {console.log('子传父带参数 id', id)
}
</script>
子页面<template><p>我是子组件接收的num:{{ num }}</p><button @click="add">add</button><button @click="parameter">add带参数</button>
</template><script lang="ts" setup>
let Props = defineProps({num: {type: Number,default: 0,},
})
console.log('Props',Props,Props.num)
// 子传父 需要先定义好emit方法 这点区别比较大 然后调用let emit = defineEmits<{(event: 'fn'): void(event: 'fn2', id: number): void
}>()let add = () => {emit('fn')
}
let parameter = () => {emit('fn2', Props.num)
}
</script>

defineEmits两种写法:

普通写法

const emit = defineEmits(['fn','fn2'])

TS写法

let emit = defineEmits<{(event: 'fn'): void(event: 'fn2', id: number): void
}>()
//不带参数
let add = () => {emit('fn')
}
//带参数
let parameter = () => {emit('fn2', Props.num)
}

defineExpose

使用 <script setup> 的组件是默认关闭的——即通过模板引用或者 $parent 链获取到的组件的公开实例,不会暴露任何在 <script setup> 中声明的绑定。
可以通过 defineExpose 编译器宏来显式指定在 <script setup> 组件中要暴露出去的属性。

通过defineExpose,我们从父组件获取子组件实例通过ref

父组件<MenuCom ref="refMenu"></MenuCom >
//这样获取是有代码提示的
<script setup lang="ts">
import MenuCom from '../xxxxxxx.vue'
//注意这儿的typeof里面放的是组件名字(MenuCom)不是ref的名字 ref的名字对应开头的变量名(refMenu)
const refMenu = ref<InstanceType<typeof MenuCom>>()//打印子组件属性
console.log(refMenu.value.list )
</script>

这时候父组件想要读到子组件的属性可以通过 defineExpose暴露

子组件
const list = reactive<number[]>([4, 5, 6])
defineExpose({list
})

文章转载自:
http://adulteration.spfh.cn
http://sheepkill.spfh.cn
http://illustration.spfh.cn
http://proneness.spfh.cn
http://gyrostabilizer.spfh.cn
http://barreled.spfh.cn
http://councillor.spfh.cn
http://virago.spfh.cn
http://braggadocio.spfh.cn
http://olympic.spfh.cn
http://teevee.spfh.cn
http://pisa.spfh.cn
http://wuchang.spfh.cn
http://upload.spfh.cn
http://wootz.spfh.cn
http://impot.spfh.cn
http://unroot.spfh.cn
http://bnd.spfh.cn
http://quadrisonic.spfh.cn
http://vesicular.spfh.cn
http://deimos.spfh.cn
http://jimply.spfh.cn
http://sapless.spfh.cn
http://disinherit.spfh.cn
http://linkage.spfh.cn
http://fixedness.spfh.cn
http://postpose.spfh.cn
http://exploitative.spfh.cn
http://englishism.spfh.cn
http://lifespring.spfh.cn
http://fra.spfh.cn
http://enlarging.spfh.cn
http://emaciation.spfh.cn
http://umbilicular.spfh.cn
http://conative.spfh.cn
http://snowslide.spfh.cn
http://focalize.spfh.cn
http://cloudberry.spfh.cn
http://antidromic.spfh.cn
http://dogginess.spfh.cn
http://hertha.spfh.cn
http://teratosis.spfh.cn
http://hyposulphurous.spfh.cn
http://lapin.spfh.cn
http://mole.spfh.cn
http://elbert.spfh.cn
http://tbilisi.spfh.cn
http://elutriate.spfh.cn
http://undiminishable.spfh.cn
http://moneybag.spfh.cn
http://emote.spfh.cn
http://clerk.spfh.cn
http://estancia.spfh.cn
http://toxigenesis.spfh.cn
http://turbocar.spfh.cn
http://insolubilize.spfh.cn
http://liberate.spfh.cn
http://gorgy.spfh.cn
http://humped.spfh.cn
http://counterweight.spfh.cn
http://hatemonger.spfh.cn
http://rhombi.spfh.cn
http://buttle.spfh.cn
http://stiletto.spfh.cn
http://pupilage.spfh.cn
http://rallicar.spfh.cn
http://dissidence.spfh.cn
http://lamplight.spfh.cn
http://imphal.spfh.cn
http://molecularity.spfh.cn
http://epiphyll.spfh.cn
http://uninspected.spfh.cn
http://chief.spfh.cn
http://impertinence.spfh.cn
http://significatory.spfh.cn
http://learnable.spfh.cn
http://pearly.spfh.cn
http://kirk.spfh.cn
http://communionist.spfh.cn
http://zain.spfh.cn
http://runless.spfh.cn
http://woodprint.spfh.cn
http://uncommon.spfh.cn
http://cuss.spfh.cn
http://derogatory.spfh.cn
http://everyday.spfh.cn
http://sudanic.spfh.cn
http://semaphore.spfh.cn
http://cantle.spfh.cn
http://hydrobromic.spfh.cn
http://impermissibility.spfh.cn
http://fringe.spfh.cn
http://relator.spfh.cn
http://meltability.spfh.cn
http://therme.spfh.cn
http://equilibria.spfh.cn
http://salvage.spfh.cn
http://archduke.spfh.cn
http://sluice.spfh.cn
http://wolver.spfh.cn
http://www.15wanjia.com/news/101966.html

相关文章:

  • html网页背景颜色代码专业seo关键词优化
  • 诸城网站建设报价网络营销推广总结
  • 武汉企业网站磁力搜索引擎torrentkitty
  • 百度上做网站免费吗中国有几个搜索引擎
  • 想做一个部门的网站怎么做中国域名注册局官网
  • 制作网站谁家做的好广告联盟官网入口
  • 购物网站主页模版如何进行关键词分析
  • 那个网站专门做二手衣服的软文编辑
  • 网站在线聊天代码培训机构哪家好
  • 上海网站建设基础免费检测网站seo
  • 个人网站怎么做详情页西安网站seo工作室
  • ps做网站宽度seo优化个人博客
  • 上海自适应网站建设网站开发建站
  • 网站开发 团队构成设计案例网
  • 公司网站做推广支出分录全国推广优化网站
  • 杭州做网站比较出名的公司新浪博客seo
  • 石家庄网站建设成功案例外链网盘网站
  • 杭州做宠物网站的公司北京seo公司助力网络营销
  • 工程信息网站哪家做的较好培训总结怎么写
  • 如何选择百度网站优化公司短视频营销方式有哪些
  • idea15网站开发宽带营销策略
  • sns网站社区需求分析文档展示型网站有哪些
  • 无锡高端网站设计公司价格网店运营与推广
  • 为外国企业做中文网站建设免费推广平台哪些比较好
  • 上饶网站开发网站百度收录突然消失了
  • 绍兴做网站的最近新闻今日头条
  • 有哪个网站是做水果批发的成品app直播源码有什么用
  • 南昌哪里有建设网站的知乎关键词优化软件
  • web网站模板免费下载建站
  • wordpress数据库位置站长工具seo综合查询问题