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

购物网站如何建设网站备案要花钱吗

购物网站如何建设,网站备案要花钱吗,东莞智通人才市场招聘官网,怎样设置个人官方网站结果 不废话,直接上结果: 方法arr.pusharr.splicearr[i] …arr …arr.length 0模板✔️✔️✔️✔️✔️watch(arr) ✖️✖️✖️✔️✖️watch(arr.value)✔️✔️✔️✖️✔️watch(arr, { deep: true })✔️✔️✔️✔️✔️watch(arr.value.len…

结果

不废话,直接上结果:

方法arr.pusharr.splicearr[i] = …arr = …arr.length = 0
模板✔️✔️✔️✔️✔️
watch(arr) ✖️✖️✖️✔️✖️
watch(arr.value)✔️✔️✔️✖️✔️
watch(arr, { deep: true })✔️✔️✔️✔️✔️
watch(arr.value.length)⚠️⚠️⚠️⚠️⚠️
watch(() => arr.value)✖️✖️✖️✔️✖️
watch(() => arr.value.length)✔️✔️✖️✔️*✔️*

从结果来看,watch(arr, { deep: true }) 最为保险,与模板行为一致。但是 deep watch 太大的对象可能会影响性能。

你可以根据上面的表格来确定到底用哪一种方法。

说明:

  1. ✔️ 表示这一列的操作能触发这一行的 watch,✖️ 同理。
  2. ⚠️ 表示报错。
  3. 列头上的操作省去了 .value。因为是在模板中执行的代码,不用加 .value

(* 见下方解释)

解释

  1. watch(arr):监听的是 ref 的值,也就是数组的引用。只有整个数组被替换时才会触发。
  2. watch(arr.value):ref 中的非原始值底层会自动改用 reactive,因此 watch arr.value 相当于 watch 底层的 reactive 对象。当数组被整个替换后,watch 的依旧是原来的数组,而不是新的数组,所以 arr = ... 不会被触发。
  3. watch(arr, { deep: true }):相当于 1 和 2 的组合。
  4. watch(arr.value.length)arr.value.length 是个数字,不是 ref 对象、reactive 对象或者 getter 函数,因此这段代码根本无法执行。
  5. watch(() => arr.value):和 1 是一样的。这点在 Vue3 文档中也有提及。
  6. watch(() => arr.value.length):4 的正确书写版。因为 watch 的是 arr 的长度,不管 arr 发生了什么,只要长度变了就会触发。测试中的 arr = ... 恰好新旧数组长度不一致,所以可以触发。

测试代码

<script setup>
import { ref, watch } from 'vue'const counter = ref(0);const arr = ref([]);
const _watch = ref([]);
const _watchValue = ref([]);
const _watchDeep = ref([]);
const _watchLength = ref('[Vue warn]: Invalid watch source:  0 A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types. ');
const _watchGetter = ref([]);
const _watchGetterLength = ref([]);   watch(arr, () => _watch.value = [...arr.value]);
watch(arr.value, () => _watchValue.value = [...arr.value]);
watch(arr, () => _watchDeep.value = [...arr.value], { deep: true });
// watch(arr.value.length, () => _watchLength.value = [...arr.value]);
watch(() => arr.value, () => _watchGetter.value = [...arr.value]);
watch(() => arr.value.length, () => _watchGetterLength.value = [...arr.value]);
</script><template><table><tbody><tr><td>模板</td><td>{{ arr }}</td></tr><tr><td>watch(arr)</td><td>{{ _watch }}</td></tr><tr><td>watch(arr.value)</td><td>{{ _watchValue }}</td></tr><tr><td>watch(arr, { deep: true })</td><td>{{ _watchDeep }}</td></tr><tr><td>arr.value.length</td><td>{{ _watchLength }}</td></tr><tr><td>watch(() => arr.value)</td><td>{{ _watchGetter }}</td></tr><tr><td>watch(() => arr.value.length)</td><td>{{ _watchGetterLength }}</td></tr></tbody></table><div class="button-group"><button @click="arr.push(counter++)">arr.push(i)</button><button @click="arr.splice(0, 1)">arr.splice(0, 1)</button><button @click="arr[0] = counter++">arr[0] = i</button><button @click="arr = [counter]">arr = [i]</button><button @click="arr.length = 0">arr.length = 0</button></div>
</template><style>
/* 样式由 Claude Sonnet 3.5 完成 */
* {font-family: consolas;
}
table {border-collapse: collapse;margin: 20px 0;width: 100%;max-width: 800px;
}td {border: 1px solid #ddd;padding: 8px 12px;
}td:first-child {font-weight: bold;background-color: #f5f5f5;width: 300px;
}.button-group {margin: 20px 0;
}button {margin-right: 10px;padding: 8px 16px;background-color: #4CAF50;color: white;border: none;border-radius: 4px;cursor: pointer;
}button:hover {background-color: #45a049;
}button:last-child {margin-right: 0;
}
</style>

文章转载自:

http://GOyymSv2.Lsfbb.cn
http://MvC28yDo.Lsfbb.cn
http://2awIfNv8.Lsfbb.cn
http://kx8pQdtR.Lsfbb.cn
http://dXz1a5d8.Lsfbb.cn
http://Fe0LapIZ.Lsfbb.cn
http://UQVgsFzp.Lsfbb.cn
http://ZndDcr6y.Lsfbb.cn
http://nca52OFA.Lsfbb.cn
http://ZA4HsWFm.Lsfbb.cn
http://w2i9iKEL.Lsfbb.cn
http://dcf7OFER.Lsfbb.cn
http://eppFX6KP.Lsfbb.cn
http://r7xcZu6q.Lsfbb.cn
http://XpwL0t5g.Lsfbb.cn
http://Bxn9AnUu.Lsfbb.cn
http://f01SCk77.Lsfbb.cn
http://7FsvENtu.Lsfbb.cn
http://jw9o7Bfa.Lsfbb.cn
http://xRIOq5JS.Lsfbb.cn
http://DRj6cgC5.Lsfbb.cn
http://AKEKr8Lo.Lsfbb.cn
http://KvpMlEyQ.Lsfbb.cn
http://0y98BUeF.Lsfbb.cn
http://AMOeTDi6.Lsfbb.cn
http://pa9PfSrz.Lsfbb.cn
http://UlXxghxw.Lsfbb.cn
http://QZGiLlir.Lsfbb.cn
http://g0Kra1WH.Lsfbb.cn
http://y0ZV6s2s.Lsfbb.cn
http://www.dtcms.com/wzjs/688339.html

相关文章:

  • 鞍山网站网站建设做软装素材从哪些网站找
  • 面试网站开发泉州哪里建设网站
  • 用php做网站视频湘潭做网站的公司
  • 统计网络网站建设的目的怎么改网站标题
  • 用什么网站做查重报告营销网站建设创意
  • 有哪些好的建站平台做的很好的黑白网站
  • 网站被黑了做网站谁家做的好
  • wordpress快速发布工具优化大师win10能用吗
  • 网站 页面风格 建设nas怎么做网站服务器
  • 为shopify做推广的网站商务网站建设ppt
  • 做淘宝客网站需要做后台吗百度热度
  • 贸易公司寮步网站建设上海建筑安全协会网站
  • 北京制作网站的公司简介网站超市源码
  • 网站自助搭建手机网站js代码
  • 李洋网络做网站网站建设推销员话术
  • 怎样选择网站服务器阳江房地产信息网官方网站
  • 如何用dw做php网站代码广州模板建站软件
  • cn域名注册重庆seo网站哪家好
  • 戴尔公司网站建设特点做网站每页面费用
  • 模板建站多少钱网站建设商家公司
  • 新浪微博 搭建网站企业形象设计调研报告
  • 怎样制作一个网站步骤宁波网站开发服务
  • 公司网站要多大空间什么网站做美式软装设计理念
  • 网站建设与管理的策划书可以做外包的网站
  • 临沂供电公司网站百度推广优化师培训
  • 继续访问这个网站网站后台文件下载
  • 网页和网站设计南宁本地网站设计
  • 沈阳制作公司网站和app网上怎么开店卖产品
  • 鹿寨县住房和城乡建设局网站网站服务器 英文
  • 网站开发实用技术pdf上海市住房和城乡建设网站