小编des*_*esh的帖子

Vue JS 非道具属性和禁用属性继承

我已阅读文档超过 5 次,但我仍然不明白禁用属性继承的用途是什么,我不明白给出的示例。

我了解 props 的工作原理,它将数据从父组件传递到子组件。

父.vue

<template>
  <div id="app">
    <Child :num="num"></Child>
  </div>
</template>

<script>
import Child from "@/components/Child";
export default {
  name: "App",
  components: {
   Child
  },
  data() {
    return {
      num: 42
    };
  }
};
</script>
Run Code Online (Sandbox Code Playgroud)

儿童.vue

<template>
  <div>
    <h2>Child</h2>
    <h4>num is {{num}}</h4>
    <div id="total">
      <h4>total is {{total}}</h4>
    </div>
  </div>
</template>
<script>
export default {
  name: "Child",
  props: {
    num: {
      type: Number,
      default: 100
    }
  },
  data() {
    return {

    };
  },
  computed: {
    total() {
      return …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-props

7
推荐指数
1
解决办法
5592
查看次数

Vue Js 安装

尝试通过安装 vue js

npm install -g @vue/cli.
Run Code Online (Sandbox Code Playgroud)

我的 npm 版本是 6.14.4,节点版本是 12.16.2

这是我得到的错误

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Unexpected end of JSON input while parsing near '...nEaUD\r\n=F4TR\r\n---'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Sudesh\AppData\Roaming\npm-cache\_logs\2020-04-16T01_32_53_989Z-debug.log
Run Code Online (Sandbox Code Playgroud)

我尝试查看回购。我不明白这个问题的解决方案是什么。

npm vue.js npm-install

1
推荐指数
1
解决办法
295
查看次数

标签 统计

vue.js ×2

javascript ×1

npm ×1

npm-install ×1

vue-props ×1