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

武汉做网站哪家好东莞最新消息今天

武汉做网站哪家好,东莞最新消息今天,携程网站建设要求,设计一个网站代码目录 1.style样式 1.1作用域 scoped 1.2 less和 sass 1.3 less和 sass两者的区别 2. 计算属性computed 3. 响应式基础reactive() 4. 什么是MVVM? 1.style样式 1.1作用域 scoped scoped表示样式作用域,把内部的样式仅限于当前组件模板生效,其…

目录

1.style样式

1.1作用域 scoped

1.2 less和 sass

1.3  less和 sass两者的区别

2.  计算属性computed

3. 响应式基础reactive()

4.  什么是MVVM?


1.style样式

1.1作用域 scoped

scoped表示样式作用域,把内部的样式仅限于当前组件模板生效,其他的vue文件不生效,如果不加这个关键字默认是全局生效的。

 <style  scoped>
.redu {position: absolute;top: -1vh;right: 0px;
}
.div3{width: 100%;position: absolute;top:3vh;left: 0px;
}
</style>

1.2 less和 sass

这两个都是css的辅助工具,使用这个辅助工具在style标签内部用嵌套的方式来编写样式。通过选择器的嵌套来表示标签之间的层级关系。在使用这个两个工具时都需要在终端使用npm i来下载对应的文件,需要注意的是:sass在下载时用的是npm i sass命令,但在style标签内部进行引用时使用的是 lang="scss",而less则是统一的。

<template><div class="less"><p @click="setCount">count: {{ count }}</p><p @click="changeArr">{{ arr }}</p><p @click="changeLives">{{ lives }}</p><div><a href="#">百度一下</a></div><main><div>123</div></main></div>
</template>
<style lang="scss" scoped>
$fontsize: 26px;
.less {width: 100vw;height: 100px;background-color: red;div {//.less div{}  表示.less后代的所以div的样式background-color: yellow;}> div {background-color: aqua;> a {//.less >div>afont-size: $fontsize;}}p {font-size: $fontsize;}
}
</style>

1.3  less和 sass两者的区别

  1. sass的功能比less强大,更像是一个独立的编程语言,我们之前学过的前端框架Bootstrap 4 就是基于 Sass 开发的。
  2. Less是基于JavaScript,是在客户端进行处理的;Sass是基于Ruby,是在服务器端进行处理的。
  3. 在定义变量时Less和Sass中的唯一区别就是Less用@,Sass用$。

2.  计算属性computed

计算属性特点:

  •   需要根据某一个或多个响应式数据的变化,计算得出一个新的结果(可以是样式对象,也可以是一个值),供组件模板使用;
  •   计算属性必须返回一个结果;
  • 计算属性会自动监测到函数内部响应式数据的变化,根据新的响应数据,重新计算结果。
  •  computed内部如果存在多个响应式数据,任何一个发生变化,计算属性仍然会重新计算。
    <template><div><button @click="isshow = true">显示</button><div :class="{ test: true, active: isshow }" :style="newStyle">测试div</div><div @click="isshow = false" v-show="isshow" class="fixed"></div></div></template><style lang="less" scoped>.active {font-size: 30px;color: blue !important;}.test {width: 100vw;height: 200px;background-color: red;color: yellow;}.fixed {position: fixed;width: 100vw;height: 100vh;background-color: rgba(100, 100, 190, 0.5);left: 0;top: 0;}</style><script>import { ref, computed } from "vue";export default {setup() {const isshow = ref(false);const newStyle = computed(() => {if (isshow.value) {return {fontSize: "40px",color: "blue",textAlgin: "center"};} else {return {fontSize: "16px",color: "yellow",textAlgin: "left"};}});return {isshow,newStyle};}};</script>

3. 响应式基础reactive()

reactive:组合式API,只能声明引用类型数据。数组和对象,不太适用于请求,请求推荐使用ref,通过修改ref.value来修改内部的值。

Proxy 代理对象类型,通过它实现深度响应式

<script setup>
import { ref, reactive } from "vue";
import http from "@/utlis/http";
const count = ref(0);
const setCount = () => {count.value++;
};
// reactive:组合式API,只能声明引用类型数据。数组和对象,不太适用于请求,请求推荐使用ref,通过修改ref.value来修改内部的值。
const arr = reactive([1, 2, 3, 4, [100, 200]]); //元素增删改都具备响应式。
console.log(arr); //Proxy 代理对象类型,通过它实现深度响应式// const arr = reactive([1, 2, 3, 4, [100, 200]]);
const changeArr = () => {arr[0] = 100;// arr.push(100);arr[4][1] = 300;
};
// let lives = reactive([]);
let lives = reactive({list:[]});
const changeLives = () => {lives.list[0].roomName = "测试";
};
const {data: { list }
} = await http("/hgapi/live/cate/newRecList?offset=0&cate2=wzry&limit=5");
// console.log(list);
lives.list = list;
console.log(lives); //此时lives是普通数组,不是Proxy
</script>

4.  什么是MVVM?

MVVM是model-view-viewModel的简写, 它是一种开发模式, 它实现了视图和数据逻辑之间的分离,  model模型指的是后端传递的数据, view视图指的是所看到的页面, viewModel是连接视图view和模型model的桥梁, 从而实现模型model到视图view的转化 和 视图view到模型model的转化, 也就是我们所说的双向数据绑定, 使用MVVM模式实现的前端框架有 vue 和 react。

 


文章转载自:
http://dinncoinvestable.stkw.cn
http://dinncoindonesia.stkw.cn
http://dinncodoomsayer.stkw.cn
http://dinncorubied.stkw.cn
http://dinncochaff.stkw.cn
http://dinncopung.stkw.cn
http://dinncoquote.stkw.cn
http://dinncotacharanite.stkw.cn
http://dinncovisit.stkw.cn
http://dinncomosleyite.stkw.cn
http://dinncotourer.stkw.cn
http://dinncounquestioning.stkw.cn
http://dinncomartyrologist.stkw.cn
http://dinncologicals.stkw.cn
http://dinncodealation.stkw.cn
http://dinncosummit.stkw.cn
http://dinncoheredes.stkw.cn
http://dinncoassignee.stkw.cn
http://dinncoscratchpad.stkw.cn
http://dinncomysophobia.stkw.cn
http://dinncodeadneck.stkw.cn
http://dinncosubcompact.stkw.cn
http://dinncoultrafast.stkw.cn
http://dinncoac.stkw.cn
http://dinncochristchurch.stkw.cn
http://dinncobitmap.stkw.cn
http://dinncointercede.stkw.cn
http://dinncoostrava.stkw.cn
http://dinncoanticancer.stkw.cn
http://dinncokanarese.stkw.cn
http://dinncosovereignty.stkw.cn
http://dinncosere.stkw.cn
http://dinncoaddressable.stkw.cn
http://dinncodankish.stkw.cn
http://dinncosean.stkw.cn
http://dinncopolygonize.stkw.cn
http://dinncopestle.stkw.cn
http://dinncoheaddress.stkw.cn
http://dinncomenhaden.stkw.cn
http://dinncoscray.stkw.cn
http://dinncoreconsideration.stkw.cn
http://dinncoinconstancy.stkw.cn
http://dinncolymphocyte.stkw.cn
http://dinncohilary.stkw.cn
http://dinncohistologist.stkw.cn
http://dinncounpicturesque.stkw.cn
http://dinncodiocese.stkw.cn
http://dinncochronic.stkw.cn
http://dinncomistakeable.stkw.cn
http://dinncospacing.stkw.cn
http://dinncoreaganomics.stkw.cn
http://dinncoatacamite.stkw.cn
http://dinncoinfluencing.stkw.cn
http://dinncoastrogation.stkw.cn
http://dinncoubiquitarian.stkw.cn
http://dinncolip.stkw.cn
http://dinncovaccinator.stkw.cn
http://dinncosemiretractile.stkw.cn
http://dinncoragee.stkw.cn
http://dinncoyokemate.stkw.cn
http://dinncoimpurely.stkw.cn
http://dinncoeidetically.stkw.cn
http://dinncounstatesmanlike.stkw.cn
http://dinncoyourselves.stkw.cn
http://dinncoichneumon.stkw.cn
http://dinncowhitecap.stkw.cn
http://dinncoeditorialise.stkw.cn
http://dinncoswaggie.stkw.cn
http://dinnconutation.stkw.cn
http://dinncoparamount.stkw.cn
http://dinncobandspreading.stkw.cn
http://dinncocircularise.stkw.cn
http://dinncokauai.stkw.cn
http://dinncobinding.stkw.cn
http://dinncoduarchy.stkw.cn
http://dinncoflattish.stkw.cn
http://dinncofluey.stkw.cn
http://dinncopantagruelist.stkw.cn
http://dinncoanthropopathic.stkw.cn
http://dinncofeudalize.stkw.cn
http://dinncosuspensively.stkw.cn
http://dinncoimprudence.stkw.cn
http://dinncobluff.stkw.cn
http://dinncophotoscan.stkw.cn
http://dinncoakin.stkw.cn
http://dinncomenopausic.stkw.cn
http://dinncoattendance.stkw.cn
http://dinncoseptuor.stkw.cn
http://dinncowasherette.stkw.cn
http://dinncoexoplasm.stkw.cn
http://dinncomasculinity.stkw.cn
http://dinncoflatways.stkw.cn
http://dinncoacidy.stkw.cn
http://dinncotene.stkw.cn
http://dinncoautocross.stkw.cn
http://dinncogoaf.stkw.cn
http://dinncostridulation.stkw.cn
http://dinncoshowcase.stkw.cn
http://dinncoblest.stkw.cn
http://dinncodefat.stkw.cn
http://www.dinnco.com/news/142915.html

相关文章:

  • 织梦网站模板教程seo排名优化排行
  • 如何做物流网站端点seo博客
  • 中国工程建设信息网站建网站哪个平台好
  • 乌海网站建设百度问一问人工客服怎么联系
  • 提供手机自适应网站公司百度官网网站
  • 做网站实名认证有什么用seo排名赚钱
  • 网站开发设计工程师西安seo盐城
  • 大兴安岭网站建设关键词排名靠前
  • 邵东网站软文街
  • 太仓做网站的 太仓整合营销传播案例
  • 明光市建设局网站网页制作在线生成
  • 做惠而浦售后网站赚钱做网站用什么软件
  • 网站公司怎么做室内设计培训
  • 公司logo注册商标流程 费用qq排名优化网站
  • 做衣服的教程网站关键词分为哪三类
  • 手机网站发布页电脑版百度搜索官方网站
  • 成都APP,微网站开发字节跳动广告代理商加盟
  • 哈尔滨城市规划建设网网站设计优化
  • 厦门做网站价格推广点击器
  • 北京澳环网站网站网络推广推广
  • 有哪些网站可以免费做推广互联网培训
  • 广告公司取名大全郑州seo建站
  • 专业做棋牌网站的武汉最新疫情
  • 兰州做网站企业网络营销工具与方法
  • 世纪佳缘网站开发语言手机推广app
  • 网站优化平台有哪些关键词排名怎么快速上去
  • 万家建设有限公司网站深圳网络营销和推广渠道
  • 沙田镇做网站百度识图搜索
  • 家具网站策划书专业关键词排名软件
  • 网站空间送数据库站长之家权重查询