#author("2022-05-13T12:45:24+08:00","default:Admin","Admin")
#author("2022-06-29T13:55:47+08:00","default:Admin","Admin")
[[Vue]]

&color(red){※前提条件:本文基于 Vue 2.0 创作};
#contents

* 概要 [#ja8e2e9c]

&color(red){组件的 data 选项必须是一个函数};

#codeprettify{{
data: function () {
  return {
    count: 0
  }
}
}}

下面时错误的示例
下面是错误的示例
#codeprettify{{
data: {
  count: 0
}
}}

* Tips [#p56e2d74]

** 获取页面跳转的参数 [#r16b6799]

下面是赋值的错误例子:
#codeprettify{{
data: function () {
  return {
    count: this.$route.params.id
  }
}
}}

#codeprettify{{
data: function () {
  return {
    count: 0
  }
},
created() {
  this.count = this.$route.params.id
}
}}

#hr();
コメント:
#comment_kcaptcha

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS