国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

大良營銷網(wǎng)站建設(shè)價(jià)位在線看crm系統(tǒng)

大良營銷網(wǎng)站建設(shè)價(jià)位,在線看crm系統(tǒng),讓wordpress完美擁有論壇功能,wordpress 日記在Vue2項(xiàng)目中可以使用this.$router.push等方法進(jìn)行路由的跳轉(zhuǎn),但是在Vue3的setup函數(shù)里,并沒有this這個(gè)概念,因此如何使用路由方法 1.// 在新的vue-router里面尤大加入了一些方法,比如這里代替this的useRouter,具體使用…

在Vue2項(xiàng)目中可以使用this.$router.push等方法進(jìn)行路由的跳轉(zhuǎn),但是在Vue3的setup函數(shù)里,并沒有this這個(gè)概念,因此如何使用路由方法

1.// 在新的vue-router里面尤大加入了一些方法,比如這里代替this的useRouter,具體使用如下:
//引入路由函數(shù)
import { useRouter } from "vue-router";
//使用
setup() {
? ? //初始化路由
? ? const router = useRouter();
? ? router.push({
? ? ? ? path: "/"
? ? });
? ??
? ? return {};
}
?

2.在vue2中可以通過this來訪問到$refs,vue3中由于沒有this所以獲取不到了,但是官網(wǎng)中提供了方法來獲取:

<template>
? <h2 ref="root">姓名</h2>
</template>
<script>
? ? import { onMounted, ref } from 'vue'
? ? export default {
? ? ? ? name: 'test9',
? ? ? ? setup(){
? ? ? ? ? ? const root ?= ref(null)
? ? ? ? ? ? onMounted(()=>{
? ? ? ? ? ? ? ? console.log(root.value);
? ? ? ? ? ? })
? ? ? ? ? ? return {
? ? ? ? ? ? ? ? root
? ? ? ? ? ? }
? ? ? ? },
? ? }
</script>

//第二種方法,也可以通過getCurrentInstance來獲取
<template>
? <h2 ref="root">姓名</h2>
</template>

<script>
? ? import { onMounted, ref, getCurrentInstance } from 'vue'

? ? export default {
? ? ? ? name: 'test9',
? ? ? ? setup(){)
? ? ? ? ? ? const {proxy} = getCurrentInstance()
? ? ? ? ? ? onMounted(()=>{
? ? ? ? ? ? ? ? console.log(proxy.$refs.root);
? ? ? ? ? ? })
? ? ? ? ? ? return {
? ? ? ? ? ? }
? ? ? ? },
? ? }
</script>

3.關(guān)于element在vue3的使用方法,沒有this.$message等方法解決方案
<template>
? <button @click="doLogin">登錄</button>
</template>

<script>
import { getCurrentInstance } from 'vue'
export default {
? name: 'Test',
? setup () {
? ? const instance = getCurrentInstance() // vue3提供的方法,創(chuàng)建類似于this的實(shí)例
? ? const doLogin = () => {
? ? ? instance.proxy.$message({ type: 'error', text: '登錄失敗' }) // 類似于this.$message()
? ? }
? ? return { doLogin }
? },
? ?// 如果想試用this.$message,須在mounted鉤子函數(shù)中,setup中沒有this實(shí)例,
? ?//但vue3.0中還是建議在setup函數(shù)中進(jìn)行邏輯操作
? mounted () {

? ? this.$message({ type: 'error', text: '登錄失敗' })
? }
}
</script>
?

http://m.aloenet.com.cn/news/32014.html

相關(guān)文章:

  • 房山成都網(wǎng)站建設(shè)肇慶seo按天收費(fèi)
  • 西安國內(nèi)做網(wǎng)站的公司有哪些排行榜前十名
  • html5flash設(shè)計(jì)開發(fā)|交互設(shè)計(jì)|網(wǎng)站建設(shè) 青島樂天seo培訓(xùn)中心
  • 網(wǎng)絡(luò)營銷策略內(nèi)容廈門seo俱樂部
  • 做網(wǎng)站需要什么技術(shù)搜索關(guān)鍵詞站長工具
  • 高端網(wǎng)站哪個(gè)比較好線上產(chǎn)品推廣方案
  • 針對人群不同 網(wǎng)站做細(xì)分全球疫情最新數(shù)據(jù)
  • 免費(fèi)空間申請網(wǎng)站網(wǎng)絡(luò)營銷在哪里學(xué)比較靠譜
  • 網(wǎng)站備案流程圖上海自動seo
  • 2015年做哪個(gè)網(wǎng)站能致富建網(wǎng)站用什么工具
  • 旅游搜索網(wǎng)站開發(fā)百度網(wǎng)站推廣怎么做
  • 鎮(zhèn)江做網(wǎng)站哪家公司好靠網(wǎng)絡(luò)營銷火起來的企業(yè)
  • 方城網(wǎng)站制作網(wǎng)絡(luò)營銷專業(yè)課程
  • 重慶的做網(wǎng)站公司百度風(fēng)云榜小說榜排名
  • 專業(yè)做網(wǎng)站價(jià)格廈門百度關(guān)鍵詞優(yōu)化
  • 網(wǎng)站推廣的技巧和方法企業(yè)網(wǎng)站的網(wǎng)絡(luò)營銷功能
  • 在什么網(wǎng)站做貿(mào)易好最簡短的培訓(xùn)心得
  • 江蘇建設(shè)廳官方網(wǎng)站安全員北京專門做seo
  • 佛山市網(wǎng)站建設(shè)保定網(wǎng)站建設(shè)方案優(yōu)化
  • 一個(gè)域名做多個(gè)網(wǎng)站快速seo優(yōu)化
  • 如何做話費(fèi)卡回收網(wǎng)站開發(fā)網(wǎng)站多少錢
  • 如何增加網(wǎng)站的訪問量手機(jī)網(wǎng)站模板免費(fèi)下載
  • 做網(wǎng)站反復(fù)修改今天熱點(diǎn)新聞事件
  • 有哪些做筆譯的網(wǎng)站怎樣下載優(yōu)化大師
  • 濟(jì)南網(wǎng)站建設(shè)找大標(biāo)深圳網(wǎng)站seo地址
  • 3合一網(wǎng)站怎么做免費(fèi)推廣工具有哪些
  • 網(wǎng)站建設(shè)與規(guī)劃方向免費(fèi)外鏈網(wǎng)盤
  • 彩票網(wǎng)站開發(fā)多少錢四川疫情最新情況
  • 棋牌游戲網(wǎng)站怎么做的seo與sem的區(qū)別
  • 做網(wǎng)站的外包能學(xué)到什么深圳最新政策消息