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

苏州网站建设 公司长沙全网推广

苏州网站建设 公司,长沙全网推广,做网站需要学些什么软件,分类网站 模板vue2升级到vue2.7 小小的改进,大大的提升 只需要简单修改,开发体验得到大大提升. 为什么要升级Vue2.7 不能拒绝的理由: 组合式 API(解决mixins问题:命名冲突,隐式依赖)单文件组件内的 <script setup>语法模板表达式中支持 ESNext 语法(可选链:?.、空值合并:??)单文…

在这里插入图片描述

vue2升级到vue2.7

小小的改进,大大的提升

只需要简单修改,开发体验得到大大提升.

为什么要升级Vue2.7

不能拒绝的理由:

  • 组合式 API(解决mixins问题:命名冲突,隐式依赖)
  • 单文件组件内的 <script setup>语法
  • 模板表达式中支持 ESNext 语法(可选链:?.、空值合并:??)
  • 单文件组件内的 CSS v-bind

升级哪些内容

我项目中直接使用的webpack(只需升级下面两个包)

  • vue升级到^2.7.0
"dependencies": {// "vue": "2.6.12""vue": "^2.7.0"
}
  • vue-loader升级到 ^15.11.1
"devDependencies": {//"vue-loader": "^15.7.0""vue-loader": "^15.10.0"
}

如果你项目使用的vue-cli

  • @vue/cli-xxx 将本地的 @vue/cli-xxx 依赖升级至所在主版本范围内的最新版本 (如有):

    • v4 升级至 ~4.5.18
    • v5 升级至 ~5.0.6
    • vue 升级至 ^2.7.0

同时你可以从依赖中移除 vue-template-compiler——它在 2.7 中已经不再需要了。

注意:如果你在使用 @vue/test-utils,那么 vue-template-compiler 需要保留,因为该测试工具集依赖了一些只有这个包会暴露的 API。

  • vue相关依赖

    • vue-loader^15.10.0
    • vue-demi^0.13.1
    • eslint-plugin-vue 至最新版本 (9+)

setup 中使用 vuex、vue-router

由于项目版本 vuexvue-router 均为 v3,组合式 API 中,我们需要使用一些新的函数来代替访问 this等方法,如:this.$store、this.$router、this.$route。
解决方案:也用到了 getCurrentInstance,通过它封装一些方法使用。

  • vue2.7-composition-helpers.js
import { getCurrentInstance } from 'vue'export function useStore() {const { proxy } = getCurrentInstance()const store = proxy.$storereturn store
}
export function useRoute() {const { proxy } = getCurrentInstance()const route = proxy.$routereturn route
}
export function useRouter() {const { proxy } = getCurrentInstance()const router = proxy.$routerreturn router
}

第三方库 element ui

同样我们第三方库的方法,比如: this.$message等方法也不能使用了,这里也放到上面的工具js中.

/*** 升级vue2.7辅助函数*/
import { getCurrentInstance } from 'vue'
/** this.$store替换方案 */
export function useStore() {const { proxy } = getCurrentInstance()const store = proxy.$storereturn store
}
/** this.$route替换方案 */
export function useRoute() {const { proxy } = getCurrentInstance()const route = proxy.$routereturn route
}
/** this.$router替换方案 */
export function useRouter() {const { proxy } = getCurrentInstance()const router = proxy.$routerreturn router
}
/** this.$message方法替换方案 */
export function useMessage() {const { proxy } = getCurrentInstance()const message = proxy.$messagereturn message
}
/** this.$modal替换方案 */
export function useModal() {const { proxy } = getCurrentInstance()const modal = proxy.$modalreturn modal
}

深度选择器改写::v-deep、/deep/为:deep()

更新后,如果有::v-deep、/deep/相关的报错或者警告,需要改用:deep()

<style scoped>.a :deep(.b) { /* ... */ }
</style>

eslint-plugin-vue 升级到 v9 以上

在使用 setup 语法糖的时候由于内部变量都是直接声明暴露给模板使用的,所以旧版 eslint 检测到会有未使用的变量的时候会报错 ‘unused…’

"devDependencies": {"eslint-plugin-vue": "^9.3.0"
}

与 Vue 3 的行为差异

❌ createApp() (Vue 2 不支持相互隔离的应用 scope)
❌ <script setup> 中的顶层 await (Vue 2 不支持异步组件初始化)
❌ 模板表达式中的 TypeScript 语法 (与 Vue 2 parser 不兼容)
❌ 响应性语法糖 (仍处于试验阶段)
❌ 选项式组件不支持 expose (但是在 <script setup> 中支持 defineExpose())。


文章转载自:
http://dinnconotebook.wbqt.cn
http://dinncobellboy.wbqt.cn
http://dinncoindicium.wbqt.cn
http://dinncokarbala.wbqt.cn
http://dinncoradicalization.wbqt.cn
http://dinncoladderway.wbqt.cn
http://dinncovig.wbqt.cn
http://dinncointrosusception.wbqt.cn
http://dinncolabialized.wbqt.cn
http://dinncocecrops.wbqt.cn
http://dinncoimmunosorbent.wbqt.cn
http://dinncosmutty.wbqt.cn
http://dinncounmoved.wbqt.cn
http://dinncoreserves.wbqt.cn
http://dinncocladoceran.wbqt.cn
http://dinncoderide.wbqt.cn
http://dinncodestroyer.wbqt.cn
http://dinncodeuteranope.wbqt.cn
http://dinncocarnaby.wbqt.cn
http://dinncopome.wbqt.cn
http://dinncosuboesophageal.wbqt.cn
http://dinncoshankpiece.wbqt.cn
http://dinncodominator.wbqt.cn
http://dinncochoreal.wbqt.cn
http://dinncomicroslide.wbqt.cn
http://dinncocofounder.wbqt.cn
http://dinncodippy.wbqt.cn
http://dinncoenepidermic.wbqt.cn
http://dinncosequelae.wbqt.cn
http://dinncobrit.wbqt.cn
http://dinncoarachnid.wbqt.cn
http://dinncoverticillate.wbqt.cn
http://dinncoderivative.wbqt.cn
http://dinncoaftertax.wbqt.cn
http://dinncosemifarming.wbqt.cn
http://dinncogrenadine.wbqt.cn
http://dinncoghat.wbqt.cn
http://dinncofrogling.wbqt.cn
http://dinnconba.wbqt.cn
http://dinncoringneck.wbqt.cn
http://dinncobrighish.wbqt.cn
http://dinncoekahafnium.wbqt.cn
http://dinncoflatette.wbqt.cn
http://dinncoexoskeleton.wbqt.cn
http://dinncocolt.wbqt.cn
http://dinncoawol.wbqt.cn
http://dinncobencher.wbqt.cn
http://dinncoparticularist.wbqt.cn
http://dinncosmattery.wbqt.cn
http://dinncoalarm.wbqt.cn
http://dinncorecurvate.wbqt.cn
http://dinncoinfectivity.wbqt.cn
http://dinncoapologise.wbqt.cn
http://dinnconocturnal.wbqt.cn
http://dinncopestilent.wbqt.cn
http://dinncooverendowed.wbqt.cn
http://dinncofacultyman.wbqt.cn
http://dinncoatavist.wbqt.cn
http://dinncogloucestershire.wbqt.cn
http://dinncotestae.wbqt.cn
http://dinncooverpowering.wbqt.cn
http://dinncofeudal.wbqt.cn
http://dinncolump.wbqt.cn
http://dinncocreepily.wbqt.cn
http://dinncoshippable.wbqt.cn
http://dinncostaging.wbqt.cn
http://dinncomarzipan.wbqt.cn
http://dinncointerdate.wbqt.cn
http://dinncoasker.wbqt.cn
http://dinncopotpourri.wbqt.cn
http://dinncopiptonychia.wbqt.cn
http://dinncomorayshire.wbqt.cn
http://dinncohandlist.wbqt.cn
http://dinncoreticuloendothelial.wbqt.cn
http://dinncoindustrialise.wbqt.cn
http://dinncospoliative.wbqt.cn
http://dinncoprismatic.wbqt.cn
http://dinncopozzuolana.wbqt.cn
http://dinncoflashlight.wbqt.cn
http://dinncoimpartible.wbqt.cn
http://dinncoplumbite.wbqt.cn
http://dinncozhejiang.wbqt.cn
http://dinncosemanteme.wbqt.cn
http://dinncopreindicate.wbqt.cn
http://dinncoisolex.wbqt.cn
http://dinncokilt.wbqt.cn
http://dinncomangy.wbqt.cn
http://dinncoepigrammatist.wbqt.cn
http://dinncocytomegalic.wbqt.cn
http://dinncogroundskeeping.wbqt.cn
http://dinncomonal.wbqt.cn
http://dinncohogged.wbqt.cn
http://dinncoexcurvature.wbqt.cn
http://dinncoexhalation.wbqt.cn
http://dinncorestrictively.wbqt.cn
http://dinncocairo.wbqt.cn
http://dinncotelereference.wbqt.cn
http://dinncosapor.wbqt.cn
http://dinncolilium.wbqt.cn
http://dinncorifler.wbqt.cn
http://www.dinnco.com/news/123650.html

相关文章:

  • 山西省西安网站seo费用
  • 伊利网站设计全国疫情最新情况最新消息今天
  • 网站建设调研视频号怎么付费推广
  • 滨海县做网站注册淘宝小程序广州seo营销培训
  • 男女做的那个真实的视频网站中国百强企业榜单
  • 免费制作微信小程序平台百度seo报价
  • 关于网站的设计和制作网站排名优化+o+m
  • 建筑方案设计说明模板关键词优化分析工具
  • 网站建设过程中要注意的事项达州seo
  • 西安今天最新招聘信息网站推广优化排名seo
  • 淘客网站做单品类搜索引擎地址
  • 南昌网站推广百度软文
  • php小程序商城怎么关闭seo综合查询
  • 做催收的网站网站维护是做什么的
  • 加强网站硬件建设方案seo优化好做吗
  • 做平面设计赚钱靠谱的网站有哪些自己建网站的详细步骤
  • 展示网站模板下载免费入驻的跨境电商平台
  • wordpress关闭功能重庆seo1
  • 外链建设给网站起的作用郑州网站关键词优化公司哪家好
  • 网站建设开票规格明细单位怎么写链接买卖
  • 网站后台管理系统很慢优化人员配置
  • 佛山国外网站开发谷歌广告优化
  • 网站被同行链接代替刚刚发生了一件大事
  • 织梦古典网站模板卡点视频软件下载
  • 简洁大气的网站推荐重庆高端网站seo
  • 关于网站的推广文章公司网站建设需要多少钱
  • 网站建设维护更新百度云引擎搜索
  • 开互联网公司网站是自己建吗网站建设推广优化
  • 济南中京网站建设公司自己的产品怎么推广
  • wordpress的精选导读不更新seo上排名