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

12306网站开发聊石家庄seo

12306网站开发,聊石家庄seo,建立网站纯文字版本,自己在哪里做网站Vue3 create-vue搭建Vue3项目 注意要使用nodejs16.0版本以上#xff0c;windows升级node可以西安使用where node查看本地node位置#xff0c;然后到官网下载msi文件#xff0c;在本地路径下安装即可 安装完可以使用node -v检查版本信息 项目目录和关键文件 组合式API - s…Vue3 create-vue搭建Vue3项目 注意要使用nodejs16.0版本以上windows升级node可以西安使用where node查看本地node位置然后到官网下载msi文件在本地路径下安装即可 安装完可以使用node -v检查版本信息 项目目录和关键文件 组合式API - setup选项 script // setup函数 // 1. 执行时机比beforeCreate还要早 // 2. setup函数中获取不到thisthis是undefined export default{setup(){// console.log(setup函数,this);},beforeCreate(){console.log(beforeCreate函数);} } /scripttemplatediv学习Vue3/div /templatescript // setup函数 // 1. 执行时机比beforeCreate还要早 // 2. setup函数中获取不到thisthis是undefined // 3. 数据和函数需要在setup最后return才能在模板中应用 export default{setup(){// console.log(setup函数,this);// 数据const message hello Vue3// 函数const logMessage () {console.log(message)}return {message,logMessage}},beforeCreate(){console.log(beforeCreate函数);} } /scripttemplatediv{{ message }}/divbutton clicklogMessage按钮/button /template!-- script // setup函数 // 1. 执行时机比beforeCreate还要早 // 2. setup函数中获取不到thisthis是undefined // 3. 数据和函数需要在setup最后return才能在模板中应用 export default{setup(){// console.log(setup函数,this);// 数据const message hello Vue3// 函数const logMessage () {console.log(message)}return {message,logMessage}},beforeCreate(){console.log(beforeCreate函数);} } /script --script setup const message hello Vue3 const logMessage(){console.log(message) } /scripttemplatediv{{ message }}/divbutton clicklogMessage按钮/button /template组合式API - reactive和ref函数 reactive() script setup // reactive语法接受对象类型数据的参数传入并返回一个响应式的对象 import { reactive } from vue; const state reactive({count:100 }) const setCount(){state.count } /scripttemplatedivdiv{{ state.count }}/divbutton clicksetCount1/button/div /templateref() script setup // reactive语法接受对象类型数据的参数传入并返回一个响应式的对象 // import { reactive } from vue; // const state reactive({ // count:100 // }) // const setCount(){ // state.count // }// 如果是简单类型怎么办 // 脚本中访问数据需要通过value // 在template中.value不需要加 import { ref } from vue const count ref(0) const setCount(){count.value } /scripttemplatedivdiv{{ count }}/divbutton clicksetCount1/button/div /template日后编码统一使用ref() 组合式API - computed script setup // const 计算属性 computed(() {return计算返回的结果})import { computed, ref } from vue; // 声明数据 const list ref([1, 2, 3, 4, 5, 6, 7, 8]);// 基于list派生一个计算属性从list中过滤出大于2 const computedList computed(() {return list.value.filter((item) item 2); });// 定义一个修改数组的方法 const addFn(){list.value.push(666) } /scripttemplatediv原始数据{{ list }}/divdiv计算后的数据{{ computedList }}/divbutton clickaddFn typebutton修改/button /template 组合式API - watch 基础使用 - 侦听单个数据 基础使用 - 侦听多个数据 script setup import {ref,watch} from vue const count ref(0) const nickname ref(张三)const changeCount(){count.value } const changeName(){nickname.value 里四 }// 1.监视单个数据的变化 // watch(ref对象,(newValue,oldValue){...}) watch(count,(newValue,oldValue){console.log(newValue,oldValue) }) // 2.监视多个数据的变化 // watch([ref对象1,ref对象2],(newArr,oldArr){...}) watch([count,nickname],(newArr,oldArr){console.log(newArr,oldArr) }) /scripttemplatediv{{ count }}/divbutton clickchangeCount改数字/buttondiv{{ nickname }}/divbutton clickchangeName改昵称/button /templateimmediate deep script setup import {ref,watch} from vue const count ref(0) const nickname ref(张三)const changeCount(){count.value } const changeName(){nickname.value 里四 }// 1.监视单个数据的变化 // watch(ref对象,(newValue,oldValue){...}) // watch(count,(newValue,oldValue){ // console.log(newValue,oldValue) // })// 2.监视多个数据的变化 // watch([ref对象1,ref对象2],(newArr,oldArr){...}) // watch([count,nickname],(newArr,oldArr){ // console.log(newArr,oldArr) // })// 3.immediate立即执行 // watch(count,(newValue,oldValue){ // console.log(newValue,oldValue) // },{ // immediate:true // })// 4.deep深度监视:默认watch进行的是浅层监视 const useInfo ref({name:张三,age:18 }) const setUserInfo(){// 修改了useInfo.value 修改了对象的地址,才能监视到// useInfo.value {name : ls,age:50}useInfo.value.age } watch(useInfo,(newValue){console.log(newValue) },{deep:true }) /scripttemplatediv{{ count }}/divbutton clickchangeCount改数字/buttondiv{{ nickname }}/divbutton clickchangeName改昵称/buttondiv{{ useInfo }}/divbutton clicksetUserInfo修改userInfo/button /template精确侦听对象的某个属性 script setup import {ref,watch} from vue const count ref(0) const nickname ref(张三)const changeCount(){count.value } const changeName(){nickname.value 里四 }// 1.监视单个数据的变化 // watch(ref对象,(newValue,oldValue){...}) // watch(count,(newValue,oldValue){ // console.log(newValue,oldValue) // })// 2.监视多个数据的变化 // watch([ref对象1,ref对象2],(newArr,oldArr){...}) // watch([count,nickname],(newArr,oldArr){ // console.log(newArr,oldArr) // })// 3.immediate立即执行 // watch(count,(newValue,oldValue){ // console.log(newValue,oldValue) // },{ // immediate:true // })// 4.deep深度监视:默认watch进行的是浅层监视 const useInfo ref({name:张三,age:18 }) const setUserInfo(){// 修改了useInfo.value 修改了对象的地址,才能监视到// useInfo.value {name : ls,age:50}useInfo.value.age }// 4. deep深度监视 // watch(useInfo,(newValue){ // console.log(newValue) // },{ // deep:true // })// 5. 对于对象中的属性,进行监视 watch(()useInfo.value.age,(newValue,oldValue){console.log(newValue,oldValue) }) /scripttemplatediv{{ count }}/divbutton clickchangeCount改数字/buttondiv{{ nickname }}/divbutton clickchangeName改昵称/buttondiv{{ useInfo }}/divbutton clicksetUserInfo修改userInfo/button /template组合式API - 生命周期函数 生命周期函数基本使用 执行多次 script setupimport { onMounted } from vue; // beforeCreated 和 created 的相关代码放在 setup 中执行 const getList () {setTimeout((){console.log(发送请求,获取数据)},2000) }// 已进入页面的请求 getList()// 如果有写代码需要在mounted生命周期中执行 onMounted((){console.log(mounted生命周期函数) }) // 可调用多次,不会冲突,按照顺序依次执行 onMounted((){console.log(mounted生命周期函数1) }) /scripttemplatediv/div /template 组合式API - 父子通信 组合式API下的父传子 script setup // 注意:由于写了setup,所以无法直接配置props // 此处要借助于编译器宏函数接收 const props defineProps({car:String,money:Number }) console.log(props.car) console.log(props.money) /scripttemplatediv classson我是子组件 - {{ car }}/div /templatestyle scoped .son {border: 1px solid #000;padding: 30px; }/stylescript setup import SonCom from /components/son-com.vue import {ref} from vue // 局部组件导入进来就能用 const money ref(100) const getMoney () {money.value10 } /scripttemplatedivh1父组件 - {{ money }}button clickgetMoney挣钱/button/h1!-- 给子组件,以添加属性的方式传值 --SonCom car宝马车 :moneymoney/SonCom/div /template 组合式API下的子传父 组合式API - 模版引用 如何使用以获取dom为例 组件同理 defineExpose() 组合式API - provide和inject 跨层传递普通数据 跨层传递响应式数据 跨层传递方法 script setup import CenterCom from /components/center-com.vue; import { provide, ref } from vue;// 1.跨层传递普通数据 provide(theme-color, pink);// 2.跨层传递响应式数据 const count ref(100); provide(count, count);setTimeout(() {count.value 500; }, 2000);// 3.跨层级传递函数,给子孙后代传递可以修改数据的方法 provide(changeCount, (newCount) {count.value newCount; }); /scripttemplatedivh1顶层组件/h1CenterCom/CenterCom/div /template script setup import BottomCom from ./bottom-com.vue/scripttemplatedivh2中间组件/h2BottomCom/BottomCom/div /template script setup import {inject} from vue const themeColor inject(theme-color) const count inject(count) const changeCount inject(changeCount) const clickFn(){changeCount(1000) } /scripttemplatedivh3底层组件 - {{ themeColor }} - {{ count }}/h3button clickclickFn更新count/button/div /template Vue3.3新特性-defineOptions Vue3.3新特性-defineModel
http://www.w-s-a.com/news/806195/

相关文章:

  • 广西建设职业技术学院教育网站牡丹区建设局网站
  • 网站后台怎么用ftp打开上海外贸进出口有限公司
  • 淘宝建设网站的意义大学生做那个视频网站
  • 如何提高你的网站的粘性建设银行流水网站
  • 微信h5在哪个网站做泰州专业网站制作公司
  • 现在.net做网站的多吗建设工程造价网
  • pc访问手机网站跳转违法网站开发人员
  • 网站前端做报名框wordpress 启动慢
  • 沈阳做网站客户多吗前端可以做网站吗
  • 网站设计规划书新媒体营销策略分析
  • dw个人网站主页怎么做天津工程信息建设网
  • 顺义做网站的公司网站页面设计基础教程
  • 安阳哪个公司做网站好企业没有做网站有的坏处
  • 网站开发有必要用php框架wordpress分页导航代码
  • wordpress建站seo鞍山制作网站哪家好
  • 网站空间流量查询上海门户网站制作
  • 网站开发技术是什么专业会的加强普法网站和普法网络集群建设
  • 上海建筑网站seo 推广
  • 乌兰察布做网站公司爱站网关键词挖掘工具站长工具
  • 白银网站建设白银申请网站空间怎么做
  • 免费炫酷网站模板网站建设需要用到什么软件有哪些
  • 电商网站开发 文献综述大型网站建设企业
  • 如何在建设部网站补录项目单仁牛商
  • 社保网站上做减员一直不审核软件程序开发
  • 网站友情链接购买天元建设集团有限公司资质
  • 南山商城网站建设哪家技术好株洲seo网站优化软件
  • 服务类网站建设18款禁用网站app直播
  • 电子商务网站建设需要物流网站开发公司
  • 网站的系统建设方式有哪些内容宁波网站建设公司
  • 网站开发 技术方案品牌建设总要求