Files
ClassContent/历届学生/font-end-nine/每天上课/2022-07-09/其他.html
2024-09-27 02:06:13 +08:00

66 lines
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="app">
<h2 v-title="test">{{ test | filTest }}</h2>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
<script>
// 混入
// 官方提供的封装方案可以解决this指向的问题
var more = {
data () {
return {
page: 1,
totalPage: 0
}
},
methods: {
getMore() {
console.log("getMore", this.test);
}
}
};
new Vue({
el: '.app',
data: {
test: '你好你好你好你好你好你好你好'
},
created() {
console.log(this.page);
this.getMore()
},
mixins: [ more ],
methods: {
},
directives: {
title: {
bind(el,binding) {
document.title = binding.value
console.log("bind: ",el,binding);
},
inserted (el,binding) {
console.log("inserted: ",el,binding);
},
update(el,binding) {
}
}
},
filters: {
filTest(val) {
return val.substring(0,4) + '...'
}
}
})
</script>
</html>