[個人筆記] vue.js 筆記與備註

  • 159
  • 0
  • 2020-06-03

人力調派 不得不支援前端專案 嘆氣!

多語系相關

如何顯示enums列舉的多語系


<div>
{{$t('enums.status["OK"]')}}
</div>


#多語系檔案那邊是長這樣

    "enums": {

        "status": {
            "OK": "OK!",
            "Success": "Success!"
        }
    },

 

 

js程式碼中取得多語系

var text = this.$i18n.t("System_Error_NotFound");

 

 

vee validate sample

			this.$validator.validate("input_name").then(valid => {
				console.log(valid);
				console.log("--------------");
			});

 

 

watch只監聽特定物件的某個欄位


	watch: {
		"pagination.page": function(newVal, oldVal) {
			console.log("------watch-------" + oldVal + " , " + newVal);
			this.getCategoriesByPagination();
		}
	},